This section outlines a basic test script that can be run from the command line to send and monitor uploading a number of documents. The script is included in the python module package you downloaded earlier, it is called pycouchtest.py and located in the couchbaseutils folder. Portions of it are included in this document.
The effects of the script are similar to the first minimal example but this one is built to give syntax usage and progress of the sets as they are completed. You can edit the script and run it or you can specify all your parameters at the command line (though not in interactive mode). Use the --help flag to see a syntax usage listing:
$ python pycouchtest.py --help Usage: pycouchtest.py [options] Options: -h, --help show this help message and exit -n 192.168.1.1:8091, --node=192.168.1.1:8091 node's ns_server ip:port -u Administrator, --user=Administrator node username -p asdasd, --password=asdasd node password -b default, --bucket=default which bucket to insert data -j True, --json=True insert json data -v False, --verbose=False run in verbose mode -i 100, --items=100 number of items to be inserted --size=100 value size,default is 256 byte --threads=100 number of threads to run load --prefix=pymc prefix to use for memcached keys and json _ids,default is uuid string
The options should look familiar already from some of our earlier tests. Put together a basic command line that uses at least the -n option. Change or set the other main ones (-b, -u, -p) to suit your situation accordingly. The script iterates through sample data 100 times by default, but that can be set using the -i option.
$ python pycouchtest.py -n localhost:8091 [###################################99%#################################### ] Thread 0 - average set time : 0.00256629943848 seconds , min : 0.00125503540039 seconds , max : 0.0297999382019 seconds , operation timeouts 0
Additional options are -j that will send a set of json data and -b to change the bucket you are inserting data into. Likewise, --size can be adjusted to insert more or less data and your keys/IDs can be given a custom prefix. You can also use the "-v True" option to show more verbose details about your connection and session.
The results of the command are a progress indicator and and then a status message summarizing the transaction.