### Subsequent Environment Setup and Instance Start Commands
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Provides commands for subsequent environment setup and starting instances for replication. These can be used for either Bob or Alice.
```bash
source ./ydbenv Bob r132 or source ./ydbenv Alice r132
./replicating_start Bob 4001 -tlsid=Bob or ./originating_start Alice Bob 4001 -tlsid=Alice -reneg=2
```
--------------------------------
### Install YottaDB and YDB Syslog Plugin (Quickstart)
Source: https://docs.yottadb.com/Plugins/ydbsyslog.html
Installs YottaDB with UTF-8 support and the YDB Syslog plugin using a provided script. This is the recommended method for a quick setup.
```bash
mkdir /tmp/tmp ; wget https://gitlab.com/YottaDB/DB/YDB/raw/master/sr_unix/ydbinstall.sh
cd /tmp/tmp ; chmod +x ydbinstall.sh
sudo ./ydbinstall.sh --utf8 --syslog
```
--------------------------------
### Install YottaDB and Web Server (Quickstart)
Source: https://docs.yottadb.com/Plugins/ydbwebserver.html
Installs YottaDB and the Web Server together using a provided script. Use the --utf8 option for UTF-8 support. If YottaDB is already installed, use the --plugins-only option.
```bash
mkdir /tmp/tmp ; wget -P /tmp/tmp https://gitlab.com/YottaDB/DB/YDB/raw/master/sr_unix/ydbinstall.sh
cd /tmp/tmp ; chmod +x ydbinstall.sh
sudo ./ydbinstall.sh --utf8 --webserver
```
--------------------------------
### Start Supplementary Instance P (of A) and Originating for Q
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Sets up P as a supplementary instance to A and as an originating instance for Q. Requires specific setup commands and backup replication start.
```bash
source ./ydbenv P r132
./db_create
./suppl_setup P startA 4000 -updok
./backup_repl startP
./originating_start P Q 4005
```
--------------------------------
### Start Replicating Instance with Secondary
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
This example demonstrates starting a Source Server for a replicating instance. It specifies the secondary instance details, log file, and instance name. The Source Server manages journal records and transports them to the secondary instance.
```bash
$ export ydb_repl_instance=multisite.repl
$ mupip set -journal="enable,before,on" -replication=on -region "*"
$ mupip replicate -instance_create -name=America
$ mupip replicate -source -start -buffsize=$jnlpool_size -secondary=localhost:1234 -log=A2B.log -instsecondary=Brazil
```
--------------------------------
### Start Replicating Instance Q (of P)
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Configures Q as a replicating secondary instance receiving from P. Uses specific setup flags.
```bash
source ./ydbenv Q r132
./db_create
./suppl_setup Q startP 4005 -updnotok
```
--------------------------------
### Setup Supplementary Instance with Update Resync
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Set up the supplementary instance for A->P replication, performing an -updateresync to start it for the first time. This is necessary for supplementary instances.
```bash
source ./ydbenv backupA r132
./db_create
./suppl_setup backupA currentstateA 4011 -updok
./repl_status
```
--------------------------------
### Initiate START of source server for secondary instance
Source: https://docs.yottadb.com/AcculturationGuide/acculturation.html
This command initiates the start of a source server for a secondary instance in a replication setup. It is typically used when a secondary instance needs to begin receiving replication updates from a primary.
```shell
ydbuser@santiago:~/jnlex$ ./replicating_start
Wed Apr 13 15:55:58 2022 : Initiating START of source server for secondary instance [dummy]
```
--------------------------------
### Basic JOB Command Usage
Source: https://docs.yottadb.com/ProgrammersGuide/commands.html
This example demonstrates the basic usage of the JOB command to start a routine with parameters in the current working directory.
```MUMPS
YDB>JOB ^TEST("V54001","")
```
--------------------------------
### Start KVM Virtual Machines with Port Forwarding
Source: https://docs.yottadb.com/AcculturationGuide/acculturation.html
Launch KVM instances, forwarding host ports for SSH and replication to the guest VMs. Adjust host ports as needed for your setup.
```bash
kvm -enable-kvm -cpu host -m 256 -display none -net nic -net user,hostfwd=tcp::2221-:22,hostfwd=tcp::4000-:3000 -hda Santiago.vmdk &
kvm -enable-kvm -cpu host -m 256 -display none -net nic -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::5000-:3000 -hda Paris.vmdk &
kvm -enable-kvm -cpu host -m 256 -display none -net nic -net user,hostfwd=tcp::2223-:22,hostfwd=tcp::6000-:3000 -hda Melbourne.vmdk &
```
--------------------------------
### YottaDB Go Quick Start and Concepts
Source: https://docs.yottadb.com/MultiLangProgGuide/index.html
Guides for getting started with YottaDB in Go, including an overview of Go error handling and return codes.
```APIDOC
## YottaDB Go Programming
### Quick Start
This section provides a quick start guide for using YottaDB with the Go programming language.
### Concepts
#### Go Error Interface
This subsection details the error handling mechanisms and return codes specific to the YottaDB Go API.
##### Go Error Return Codes
- **DBRNDWNBYPASS**: Indicates a bypass of the database rundown.
- **INVLKNMPAIRLIST**: Signifies an invalid lock name/pair list.
- **SIGACKTIMEOUT**: Represents a timeout while waiting for a signal acknowledgment.
```
--------------------------------
### Create Database and Set Up Replication on Instance A
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Create the database files and configure replication settings for instance A.
```bash
./db_create
%GDE-I-LOADGD, Loading Global Directory file
/home/user/A/yottadb.gld
%GDE-I-VERIFY, Verification OK
%GDE-I-EXECOM, Executing command file /home/user/A/gdemsr
%GDE-I-VERIFY, Verification OK
%GDE-I-GDUPDATE, Updating Global Directory file
/home/user/A/yottadb.gld
%YDB-I-DBFILECREATED, Database file /home/user/A/yottadb.dat created
```
```bash
./repl_setup
%YDB-I-JNLCREATE, Journal file /home/user/A/yottadb.mjl created for region DEFAULT with BEFORE_IMAGES
%YDB-I-JNLSTATE, Journaling state for region DEFAULT is now ON
%YDB-I-REPLSTATE, Replication state for region DEFAULT is now ON
```
--------------------------------
### Start YottaDB Replication (Receiving Pi)
Source: https://docs.yottadb.com/ApplicationsManual/demopi.html
Starts the YottaDB replication source and receive processes on the receiving Pi. This script is used for subsequent starts after the initial setup.
```bash
#!/bin/sh
$ydb_dist/mupip replicate -source -start -passive -instsecondary=dummy -log=/home/pi/repl_scripts/passive_server_start.log -updok
$ydb_dist/mupip replicate -receive -start -listenport=4000 -log=/home/pi/repl_scripts/receive.log -autorollback
$ydb_dist/mupip replicate -receive -checkhealth
tail -20 /home/pi/repl_scripts/receive.log
```
--------------------------------
### Set up Replication Environment on Instance A
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initializes the environment and sets up replication for instance A. This is a prerequisite for starting the originating server.
```bash
source ./ydbenv A r132
./db_create
./repl_setup
./originating_start A B 4001
$ydb_dist/yottadb -r %XCMD 'for i=1:1:100 set ^A(i)=i'
./repl_status #-SHOWBACKLOG and -CHECKHEALTH report
```
--------------------------------
### Example of $GET() Function
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Demonstrates retrieving the value of a variable or global node, returning a default if it doesn't exist, using $GET().
```M
$GET(variable,default_value)
```
```M
$GET(^global(index),"0")
```
--------------------------------
### Get YottaDB Version Information
Source: https://docs.yottadb.com/AcculturationGuide/acculturation.html
Display detailed build information for the installed YottaDB release. This helps verify the installation.
```bash
$ /usr/local/bin/ydb -version
YottaDB release: r2.00
Upstream base version: GT.M V7.0-001
Platform: Linux x86_64
Build date/time: 2024-02-19 17:22
Build commit SHA: d87c9140bf6c3928925d4c842a396676f1f48989
$
```
--------------------------------
### Install YottaDB from Source
Source: https://docs.yottadb.com/AdminOpsGuide/installydb.html
Clones a YottaDB repository, builds it, and installs it. This example installs the 'working' branch from a specified GitLab repository, including the Application Independent Metadata plugin, into a date-stamped directory.
```bash
ydbinstall --from-source https://gitlab.com/ydbuser/YDB.git --branch working --utf8 --aim --install-directory /usr/local/lib/yottadb/devel_$(date +%Y%m%d)
```
--------------------------------
### Configure and Start Replication
Source: https://docs.yottadb.com/AdminOpsGuide/ipcresource.html
Commands to set up replication, including creating an instance, enabling replication, and starting a replication stream with specific buffer size and logging.
```bash
$ export ydb_repl_instance=multisite.repl
$ mupip replicate -instance_create -name=America
$ mupip set -replication=on -region "*"
$ mupip replicate -source -start -buf=1048576 -secondary=Server_B:1234 -log=A2B.log -instsecondary=Brazil
```
--------------------------------
### Retrieve Data with GET
Source: https://docs.yottadb.com/Plugins/ydbwebserver.html
Example of retrieving data using a GET request after a POST or PUT operation. The URL for the data is returned with each storage request.
```bash
$ curl http://localhost:9081/text/5
LIFE OF LEONARDO DA VINCI: Painter and Sculptor of Florence
The greatest gifts are often seen, in the course of nature, rained by celestial influences on human creatures; ...
```
--------------------------------
### Example: Activating a Source Server
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
This example demonstrates activating a source server from passive mode, specifying the secondary host and port, log file, and the secondary instance name.
```bash
$ mupip replicate -source -activate -secondary=localhost:8998 -log=A2B.log -instsecondary=America
```
--------------------------------
### Synchronous and Asynchronous get() Example
Source: https://docs.yottadb.com/MultiLangProgGuide/jsprogram.html
Demonstrates calling the 'get()' method synchronously and asynchronously. The asynchronous call uses a callback function to handle the result.
```javascript
// get() being called synchronously
> ydb.get({global:'num'});
{ ok: true, global: 'num', data: 1, defined: true }
// get() being called asynchronously
> ydb.get({global:'num'}, (error,result) => {if (!error) {console.log('result:', result);}});
undefined
> result: { ok: true, global: 'num', data: 1, defined: true }
```
--------------------------------
### Turn Replication On
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Turn replication on and create the replication instance file. This is a preparatory step before starting the instances.
```bash
$ ./repl_setup
```
--------------------------------
### Example of %JSWRITE Output for Array Descendants
Source: https://docs.yottadb.com/ProgrammersGuide/utility.html
This example shows the JSON output generated by %JSWRITE when processing all descendants of a global variable starting from a specific node.
```json
[{"demodevtest":{"Developer2":{"Token3":{"testSetup":"runtest holt maintest tconv"}}}},{"demodevtest":{"Developer2":{"Token3":{"testSetup":{"holt":{"65401,21987":1}}}}}},{"demodevtest":{"Developer2":{"Token3":{"testSetup":{"holt":{"t":"mtest"}}}}}},{"demodevtest":{"Developer2":{"Token3":{"testSetup":{"holt":{"t":{"SendReport":{"65401":{"22073":1}}}}}}}}},{"demodevtest":{"Developer2":{"Token3":{"testSetup":{"holt":{"t":{"tconv":{"65401":{"22025":0}}}}}}}}},{"demodevtest":{"Developer3":{"Token4":{"testSetup":"runtest holt maintest tconv"}}}},{"demodevtest":{"Developer3":{"Token4":{"testSetup":{"holt":{"65401,31987":1}}}}}},{"demodevtest":{"Developer3":{"Token4":{"testSetup":{"holt":{"t":"mtest"}}}}}},{"demodevtest":{"Developer3":{"Token4":{"testSetup":{"holt":{"t":{"SendReport":{"65401":{"32073":1}}}}}}}}},{"demodevtest":{"Developer3":{"Token4":{"testSetup":{"holt":{"t":{"tconv":{"65401":{"32025":0}}}}}}}}}]
```
--------------------------------
### Start Backup Replication on Q
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Starts a backup replication process on instance Q.
```bash
./backup_repl startQ
```
--------------------------------
### CLEAR -LOCK Qualifier Example
Source: https://docs.yottadb.com/AdminOpsGuide/mlocks.html
Example of using the -LOCK qualifier to clear locks starting with a specific resource name. Demonstrates handling of quoted subscripts.
```text
LKE> clear -lock="^x(\",\")"
DEFAULT
^x(",") Owned by PID= 13295 which is an existing process
Clear lock ? y
Lock removed : ^x(",")
LKE>
```
--------------------------------
### Create Database and Replication Instance File on Instance B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Create the database files and the replication instance file for instance B.
```bash
./db_create
```
```bash
./repl_setup
```
--------------------------------
### Start Source Server on Existing P
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Start the Source Server on instance P with update permissions enabled for local updates.
```bash
mupip replicate -source -start -passive -buf=1048576 -log=home/user/P/P.log -updok
```
--------------------------------
### Python set() and get() Example Usage
Source: https://docs.yottadb.com/MultiLangProgGuide/pythonprogram.html
Illustrates the usage of set() to update a variable and get() to retrieve its value. It shows setting a variable with subscripts and then printing its value, which is returned as bytes.
```python
print(yottadb.get("mylocal", ("sub1", "sub2"))) # Prints None
yottadb.set("mylocal", ("sub1", "sub2"), "test")
print(yottadb.get("mylocal", ("sub1", "sub2"))) # Prints b'test'
```
--------------------------------
### Example of $FIND() Function
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Shows how to find the starting position of a substring within a string using $FIND().
```M
$FIND(string,substring)
```
--------------------------------
### Example of VIEW Command
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Shows how to query system parameters and settings using the VIEW command.
```M
VIEW "DBFLUSH"
```
```M
VIEW "JNLWAIT"
```
```M
VIEW "NOISOLATION":1
```
```M
VIEW "PATCODE":"MYTABLE"
```
```M
VIEW "TRACE":1:"MYEXPR"
```
```M
VIEW "ZDATE_FORM":"MM/DD/YYYY"
```
--------------------------------
### Set up Replication Environment on Instance A
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initializes the replication environment on instance A, starting it as an originating instance for both B and P, and populating initial data.
```bash
source ./ydbenv A r1.20_x86_64
./db_create
./repl_setup
./originating_start A B 4010
./originating_start A P 4011
./backup_repl startA
$ydb_dist/yottadb -r ^%XCMD 'for i=1:1:97 set ^A(i)=i'
```
--------------------------------
### Example of $NAME() Function
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Shows how to get the M global variable name of a variable or expression using $NAME().
```M
$NAME(variable)
```
--------------------------------
### Start YottaDB and Edit Source File
Source: https://docs.yottadb.com/ProgrammersGuide/devcycle.html
This example shows how to enter YottaDB from the shell and then use ZEDIT to start an editing session for a source file named 'payroll'. The .m extension is automatically handled.
```bash
$ ydb
YDB>ZEDIT "payroll"
```
--------------------------------
### Start backup replication on A
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initiate backup replication from instance A. This command is typically run after setting up originating instances.
```bash
./backup_repl startA
```
--------------------------------
### Simplify Status Assignment with one-argument $GET()
Source: https://docs.yottadb.com/ProgrammersGuide/functions.html
Reduces the previous example to two lines using the one-argument $GET() function. Note that this form can mask the difference between an undefined variable and one with a null value.
```YottaDB
set STATUS=$get(^PNT(NAME,TSTR))
if STATUS="" set STATUS="WAITING FOR RESULT"
```
--------------------------------
### Example of ZSHOW Command
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Demonstrates displaying system information and variables using ZSHOW.
```M
ZSHOW "*"
```
```M
ZSHOW "V"
```
--------------------------------
### Get String Length in Characters
Source: https://docs.yottadb.com/ProgrammersGuide/functions.html
Calculates and writes the length of a string in characters. No special setup is required.
```YottaDB
Write $length("KINGSTON")
8
```
--------------------------------
### Start Source Server on Instance A
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initiate the replication source server on instance A to send data to instance B.
```bash
./originating_start A B 4001
Wed Jul 18 12:45:46 2018 : Initiating START of source server for secondary instance [B]
Wed Jul 18 12:45:46 2018 : Initiating CHECKHEALTH operation on source server pid [18498] for secondary instance name [B]
PID 18498 Source server is alive in ACTIVE mode
Wed Jul 18 12:45:46 2018 : /usr/local/lib/yottadb/r132/mupip replicate -source -start -instsecondary=B -secondary=localhost:4001 -buffsize=1048576 -log=/home/user/A/A_B.log
Wed Jul 18 12:45:46 2018 : %YDB-I-REPLINFO, GTM Replication Source Server with Pid [18498] started for Secondary Instance [B]
Wed Jul 18 12:45:46 2018 : Created jnlpool with shmid = [1353941014] and semid = [1447755780]
Wed Jul 18 12:45:46 2018 : %YDB-I-REPLINFO, GTM Replication Source Server now in ACTIVE mode using port 4001
Wed Jul 18 12:45:46 2018 : Connect hard tries count = 5, Connect hard tries period = 500
Wed Jul 18 12:45:46 2018 : 1 hard connection attempt failed : Connection refused
```
--------------------------------
### Example of ZGOTO Command
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Demonstrates an enhanced GOTO functionality with ZGOTO.
```M
ZGOTO 100
```
--------------------------------
### Set up supplementary instance P
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Configure instance P as a supplementary instance replicating from instance A. This involves sourcing environment variables, creating the database, setting up supplementary replication, and populating initial data.
```bash
source ./ydbenv P r132
./db_create
./suppl_setup P startA 4011 -updok
$ydb_dist/yottadb -r ^%XCMD 'for i=1:1:40 set ^P(i)=i'
```
--------------------------------
### YDB Web Server XML Response Routine
Source: https://docs.yottadb.com/Plugins/ydbwebserver.html
An M routine example that generates an XML response for a GET /test/xml request.
```mumps
xml ; GET /test/xml XML sample
set httprsp("mime")="text/xml"
set httprsp(1)=""
set httprsp(2)=""
set httprsp(3)="Tovaniannnn"
set httprsp(4)="Jani"
set httprsp(5)="Reminders"
set httprsp(6)="Don't forget me this weekend!"
set httprsp(7)=""
quit
```
--------------------------------
### Backup Directory Setup and Environment Configuration
Source: https://docs.yottadb.com/AcculturationGuide/acculturation.html
This sequence of shell commands demonstrates setting up a backup directory, copying environment and global directory files, and modifying the environment file to point to the new backup location.
```shell
ydbuser@paris:~/jnlex$ mkdir backup ; cd backup
ydbuser@paris:~/jnlex/backup$ cp ../jnlex_env jnlex_bak_env
ydbuser@paris:~/jnlex/backup$ cp ../ydb.gld ./
ydbuser@paris:~/jnlex/backup$ nano jnlex_bak_env
ydbuser@paris:~/jnlex/backup$ cat jnlex_bak_env
export ydb_dist=/usr/local/etc
export ydb_routines=". $ydb_dist/libyottadbutil.so"
alias yottadb=$ydb_dist/yottadb
alias mupip=$ydb_dist/mupip
export ydb_dir=$HOME/jnlex/backup
export ydb_gbldir=$ydb_dir/ydb.gld
export ydb_chset=utf-8
export LC_ALL=C.UTF-8
export ydb_icu_version=$(pkg-config --modversion icu-io)
export ydb_principal_editing=EDITING
export ydb_repl_instance=$ydb_dir/paris.repl
export ydb_repl_instname=paris
```
--------------------------------
### Python get() Example
Source: https://docs.yottadb.com/MultiLangProgGuide/pythonprogram.html
Retrieves the value at a specified node. Returns None if the node does not exist (GVUNDEF or LVUNDEF error).
```python
print(yottadb.get("mylocal", ("sub1", "sub2")) # Prints None
yottadb.set("mylocal", ("sub1", "sub2"), "test")
print(yottadb.get("mylocal", ("sub1", "sub2")) # Prints b'test'
```
--------------------------------
### Set up originating instance A for replication to B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Configure instance A as the originating instance for replication to instance B. This involves sourcing environment variables, creating the database, setting up replication, starting the originating instance, and initiating backup replication.
```bash
source ./ydbenv A r132
./db_create
./repl_setup
./originating_start A B 4010
./originating_start A P 4011
./backup_repl startA
$ydb_dist/yottadb -r ^%XCMD 'for i=1:1:97 set ^A(i)=i'
```
--------------------------------
### Set ydb_dist Environment Variable
Source: https://docs.yottadb.com/ProgrammersGuide/devcycle.html
Specifies the installation directory for YottaDB program and support files. This example sets the directory to '/usr/local/lib/yottadb/r132'.
```shell
$ ydb_dist=/usr/local/lib/yottadb/r132
$ export ydb_dist
```
--------------------------------
### Displaying $ECODE for Error Information
Source: https://docs.yottadb.com/ProgrammersGuide/opdebug.html
This example demonstrates how to display the contents of the $ECODE special variable to get a history of error codes.
```MUMPS
YDB>WRITE $ECODE
,M6,Z150373850
```
--------------------------------
### Example of JOB Command
Source: https://docs.yottadb.com/ProgrammersGuide/index.html
Illustrates launching a new process using the JOB command with various parameters.
```M
JOB "ROUTINE"
```
```M
JOB "ROUTINE" : "ARG1,ARG2"
```
```M
JOB "ROUTINE" : ,"INFILE","OUTFILE"
```
```M
JOB "ROUTINE" : ,,"ERRFILE"
```
```M
JOB "ROUTINE" : ,,,,"DEFAULT"
```
```M
JOB "ROUTINE" : ,,,,,"/path/to/shell/script"
```
--------------------------------
### Set up Replication Environment on Instance B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initializes the environment and sets up replication for instance B. This is required for the replicating instance before starting the receiver.
```bash
source ./ydbenv B r132
./db_create
./repl_setup
./replicating_start B 4001
./repl_status # -SHOWBACKLOG and -CHECKHEATH report
./replicating_stop # Shutdown the Receiver Server and the Update Process
```
--------------------------------
### Interactive Routine Selection
Source: https://docs.yottadb.com/ProgrammersGuide/utility.html
This example demonstrates selecting two source routines starting with 'TES' and then attempting to select object modules, which are not found.
```MUMPS
YDB>DO ^%RSEL
Routine: TES*
TEST2 TEST3
Current total of 2 routines
Routine:
YDB>DO OBJ^%RSEL
Routine:TEST?
Current total of 0 routines
Routine:
YDB>ZWRITE
%ZR=0
```
--------------------------------
### Install YottaDB Python Wrapper
Source: https://docs.yottadb.com/AcculturationGuide/acculturation.html
Sets up a Python virtual environment and installs the YottaDB wrapper from PyPI.
```bash
ydbuser@ydbdev:~$ python3 -m venv .venv
ydbuser@ydbdev:~$ source .venv/bin/activate
(.venv) ydbuser@ydbdev:~$ pip install yottadb
```
--------------------------------
### AFTER Time Qualifier Example
Source: https://docs.yottadb.com/AdminOpsGuide/ydbjournal.html
Specifies the starting timestamp for journal file processing after which actions should commence. Compatible with EXTRACT, SHOW, or VERIFY commands.
```bash
-A[FTER]=time
```
--------------------------------
### Set up supplementary instance P for automatic rollback scenario
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Configure instance P as a supplementary instance replicating from A, including sourcing environment variables, creating the database, setting up supplementary replication, and populating initial data.
```bash
source ./ydbenv P r132
./db_create
./suppl_setup P startA 4000 -updok
$ydb_dist/yottadb -r %XCMD 'for i=1:1:38 set ^P(i)=i'
```
--------------------------------
### YottaDB M Mode Routine Path with POSIX Plugin
Source: https://docs.yottadb.com/AdminOpsGuide/basicops.html
Example of `ydb_routines` with the POSIX plugin installed, demonstrating custom paths for routines and utilities.
```shell
/home/jdoe1/.yottadb/r1.36/o*(/home/jdoe1/.yottadb/r1.36/r /home/jdoe1/.yottadb/r) /usr/local/lib/yottadb/r136/plugin/o/_ydbposix.so /usr/local/lib/yottadb/r136/libyottadbutil.so
```
--------------------------------
### Start Backup of Replication Instance B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Create a backup of the replication instance file for B. This is a preparatory step before B becomes the new originating instance.
```bash
./backup_repl startB
```
--------------------------------
### Get Environment Variable Value with $ZTRNLNM
Source: https://docs.yottadb.com/ProgrammersGuide/functions.html
Retrieves the value of an environment variable. This example shows retrieving 'ydb_dist' with and without optional parameters.
```YottaDB
YDB>write $ztrnlnm("ydb_dist","","","","","VALUE")
/usr/local/lib/yottadb/r120/utf8
YDB>write $ztrnlnm("ydb_dist")
/usr/local/lib/yottadb/r120
YDB>
```
--------------------------------
### USE Command Example
Source: https://docs.yottadb.com/ProgrammersGuide/ioproc.html
This example demonstrates using the USE command to select the principal device and modify its behavior with device parameters like turning off echo and positioning the cursor.
```YottaDB
USE $P:(X=0:Y=$Y-1:NOECHO)
```
--------------------------------
### GET /test/xml
Source: https://docs.yottadb.com/Plugins/ydbwebserver.html
Invokes the xml^%ydbwebapi routine to handle requests for /test/xml. This is a simple example of mapping a URL path to a specific M routine.
```APIDOC
## GET /test/xml
### Description
Invokes the `xml^%ydbwebapi` routine to handle requests for `/test/xml`. This is a simple example of mapping a URL path to a specific M routine.
### Method
GET
### Endpoint
`/test/xml`
### Request Example
```
curl http://localhost:9080/test/xml
```
### Response
#### Success Response (200)
Returns data processed by the `xml^%ydbwebapi` routine.
```
--------------------------------
### Set up Replication Environment on Instance B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Initializes the replication environment on instance B, setting it up as a replicating instance for A.
```bash
source ./ydbenv B r1.20_x86_64
./db_create
./repl_setup
./replicating_start B 4010
```
--------------------------------
### Node.js: Get node tree
Source: https://docs.yottadb.com/MultiLangProgGuide/index.html
Retrieves an entire subtree of values starting from a YottaDB node. Allows specifying maximum depth and filtering.
```JavaScript
node.gettree(max_depth, filter)
```
--------------------------------
### Set up replicating instance B
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Configure instance B as a replicating secondary instance receiving data from instance A. This involves sourcing environment variables, creating the database, setting up replication, and starting the replicating instance.
```bash
source ./ydbenv B r132
./db_create
./repl_setup
./replicating_start B 4010
```
--------------------------------
### Backup Replication Instance File and Start Originating Instance
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Preserve the backup of the replication instance file representing the state at the time of starting the instance. Then, populate the database with sample data and create a backup of the replication instance.
```bash
./backup_repl startingA #Preserve the backup of the replicating instance file that represents the state at the time of starting the instance.
$ydb_dist/yottadb -r %XCMD 'for i=1:1:10 set ^A(i)=i'
mkdir backupA
$ydb_dist/mupip backup -replinst=currentstateA -newjnlfile=noprevlink -bkupdbjnl=disable DEFAULT backupA
```
--------------------------------
### Starting Source Server with Secondary Instance
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Starts the Source Server for a given originating instance, specifying 'B' as its replicating instance. This command uses replication parameters like buffer size and log file.
```shell
$ mupip replicate -source -start -buffsize=$gtm_buffsize -secondary=localhost:1234 -log=A2B.log -instsecondary=B
```
--------------------------------
### Extracting Globals with Wildcards
Source: https://docs.yottadb.com/AdminOpsGuide/ydbjournal.html
Use the -GLOBAL qualifier with wildcards to extract journal records for specific globals. This example extracts all globals starting with 'A' and 'C'.
```bash
$ mupip journal -forward -extract -global="^A*,^C" yottadb.mjl
```
```bash
$ mupip journal -forward -extract -global="(^A*,^C)" yottadb.mjl
```
--------------------------------
### Backup Replication Instance for New Setup
Source: https://docs.yottadb.com/AdminOpsGuide/dbrepl.html
Take a backup of the replication instance file and the database together. This is used when setting up a new replicating instance from a backup.
```bash
mupip backup -replinst=backupA
```
--------------------------------
### YottaDB Docker Container Quick Start
Source: https://docs.yottadb.com/AdminOpsGuide/index.html
This snippet provides the Docker pull command for obtaining the YottaDB Docker image, facilitating quick setup.
```bash
Docker Pull Command
```