Installation Environment
Cent OS 7
Cockroach v1.0
1. Download the installation file and unzip it
#tar xfz cockroach-v1.0.2.linux-amd64.tgz
add command to PATH
#cp -i cockroach-v1.0.2.linux-amd64/cockroach /usr/local/bin
verify
#cockroach version
Build Tag: v1.0.2
Build Time: 2017/06/15 12:58:59
Distribution: CCL
Platform: linux amd64
Go Version: go1.8.3
C Compiler: gcc 6.3.0
Build SHA-1: 9e3606bd2863ce7a460fd0c842414673d62f0533
Build Type: release
2. Start the local cluster
first node
#cockroach start --insecure --host=localhost CockroachDB node starting at 2017-07-02 15:24:13.041435481 +0800 CST build: CCL v1.0.2 @ 2017/06/15 12:58:59 (go1.8.3) admin: http://localhost:8080 sql: postgresql://root@localhost:26257?sslmode=disable logs: /root/cockroach-data/logs store[0]: path=/root/cockroach-data status: restarted pre-existing node clusterID: aa46599a-2420-4c54-aff9-c3e4668a2633 nodeID: 1
add other nodes
#cockroach start --insecure --store=node2 --host=localhost --port=26258 --http-port=8081 --join=localhost:26257 #cockroach start --insecure --store=node3 --host=localhost --port=26259 --http-port=8082 --join=localhost:26257
3. Connect to the database
#cockroach sql --insecure #cockroach sql --insecure --port=26258 //Connect to other nodes
execute SQL
Exit SQL "\q", stop node CTRL + C
4. Restart the cluster
#cockroach start --insecure --host=localhost #cockroach start --insecure --store=node2 --host=localhost --port=26258 --http-port=8081 --join=localhost:26257 #cockroach start --insecure --store=node3 --host=localhost --port=26259 --http-port=8082 --join=localhost:26257
In addition, CockroachDB also supports Docker to build clusters