Create a script to configure the data store

Note:

You must follow the configuration steps as mentioned in Configuring your data store installation before running the Admin CLI.

You now know how to configure a data store using an interactive command line interface session. However, you can collect all of the commands used in the prior sections into a script file, and then run the script in a single batch operation. To do this, use the load command in the command line interface. For example:

Using the load -file command line option:

ssh node01
> java -Xmx64m -Xms64m \
-jar $KVHOME/lib/kvstore.jar runadmin -port 5000 -host $KVHOST \
-security $KVROOT/security/client.security \
load -file script.txt
Using directly the load -file command. First start runadmin to use the Admin command line interface (CLI) for administration purposes:

 java -Xmx64m -Xms64m \
-jar $KVHOME/lib/kvstore.jar runadmin -port 5000 -host node01 \
-security $KVROOT/security/client.security 
kv-> load -file <path to file> 

Using this command you can load the named file and interpret its contents as a script of commands to be executed.

The file, script.txt, would contain content like the code snippet shown below. Note that the name of the store in this example is mystore.

### Begin Script ###
configure -name mystore
plan deploy-zone -name "Boston" -rf 3 -wait
plan deploy-sn -zn zn1 -host <hostname> -port 5000 -wait
plan deploy-admin -sn sn1 -wait
pool create -name BostonPool
pool join -name BostonPool -sn sn1
plan deploy-sn -zn zn1 -host <host2> -port 5000 -wait
pool join -name BostonPool -sn sn2
plan deploy-sn -zn zn1 -host <host3> -port 5000 -wait
pool join -name BostonPool -sn sn3
topology create -name topo -pool BostonPool -partitions 300
plan deploy-topology -name topo -wait
exit
### End Script ###