Using a Script to Configure the Store

Note:

You must follow the configuration steps as mentioned in Configuring Your KVStore Installation before running the Admin CLI.

Up to this point, we have shown how to configure a 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 them 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 node01 \
-security \
KVROOT/security/client.security \
load -file script.txt

Using directly the load -file command:

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 this script. Note that the name of the store in this example is BostonArea, rather one of the names used previously, such as MetroArea:

### Begin Script ###
configure -name BostonArea
plan deploy-zone -name "Boston" -rf 3 -wait
plan deploy-sn -zn zn1 -host node01 -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 node02 -port 6000 -wait
pool join -name BostonPool -sn sn2
plan deploy-sn -zn zn1 -host node03 -port 7000 -wait
pool join -name BostonPool -sn sn3
topology create -name topo -pool BostonPool -partitions 300
plan deploy-topology -name topo -wait
exit
### End Script ### 

Follow the instructions mentioned in Configuring Security with Remote Access to create the access for the user in the multiple zone deploy example.