Docker
Using the image
Running a container
Run a container with bash:
docker run -it lsilvest/ztsdb bash
Starting ztsdb
In this shell, start an instance of ztsdb:
ztsdb
You can use the quit command to terminate the ztsdb instance at any time:
q()
Running multiple instances
One can start multiple containers to test multiple instances or to simulate real-time append to time-series. To access an instance from outside the container, publish the listen port when running the container:
docker run -it -p 19300:19300 lsilvest/ztsdb bash
Make note of the IP address of the container; Here is one way of getting it:
ip addr show
In this example, we will assume the container's IP address is 172.17.0.2.
In this shell, start a ztsdb instance listening on the published port:
ztsdb -p 19300
Connecting from another ztsdb instance
Other ztsdb instances can be started in the same way as above. Once the ztsdb has been started, a connection can be established as usual from the ztsdb command line:
c1 <- connection("172.17.0.2", 19300)
Append utility
The append utility generates append messages for a time-series at a specified frequency:
usage: append <ip> <port> <rate> <varname[,name1,name2,...]> <ncols> [max-msgs]
To use it, a time-series must first be created on the ztsdb server instance:
data <- matrix(0, 0, 3, dimnames=list(NULL, c("a","b","c")))
idx <- as.nanotime(NULL)
a <<- zts(idx, data)
Then append can be started from another container like this (IP address=172.17.0.2, port=19300, rate=100000 msg/second, time-series' name=a, number of columns=3, continue sending indefinitely):
append 172.17.0.2 19300 100000 a 3
More information on the append utility can be found here.
Further info
For more details about starting a ztsdb instance, see the Running ztsdb section.
For more details on using ztsdb, see the Reference section.