CRDB安装配置步骤
by coco
机器:10.102.0.20
账户密码:root/123456
#安装目录:
[root@BFID20 crdb]# pwd
/usr/local/crdb
[root@BFID20 crdb]# ll
total 110096
-rwxr-xr-x 1 root root 56364824 Jan 10 15:01 cockroach
-rw-r----- 1 root root 56371200 Jan 10 15:01 cockroachdb_2.0.tar
# 创建证书:
[root@BDPPGP0C04 crdb]# mkdir certs
[root@BDPPGP0C04 crdb]# mkdir my-safe-directory
[root@BDPPGP0C04 crdb]# ./cockroach cert create-ca --certs-dir=certs --ca-key=my-safe-directory/ca.key
[root@BDPPGP0C04 crdb]# ./cockroach cert create-client root --certs-dir=certs --ca-key=my-safe-directory/ca.key
[root@BDPPGP0C04 crdb]# ./cockroach cert create-node localhost BFID20 --certs-dir=certs --ca-key=my-safe-directory/ca.key
[root@BFID20 crdb]# ll
total 110108
drwxr-xr-x 2 root root 4096 Jan 10 15:25 certs
-rwxr-xr-x 1 root root 56364824 Jan 10 15:01 cockroach
drwxr-xr-x 5 root root 4096 Jan 10 15:25 cockroach-data
-rw-r----- 1 root root 56371200 Jan 10 15:01 cockroachdb_2.0.tar
drwxr-xr-x 2 root root 4096 Jan 10 15:24 my-safe-directory
#启动节点(安全模式)
[root@BDPPGP0C04 crdb]# /usr/local/crdb/cockroach start --certs-dir=certs --host=localhost --http-host=localhost
----若是使用非安全模式./cockroach start --insecure --host=localhost
#root用户登陆
[root@BFID20 crdb]# ./cockroach sql --certs-dir=certs --host=localhost
# Welcome to the cockroach SQL interface.
# All statements must be terminated by a semicolon.
# To exit: CTRL + D.
#
# Server version: CockroachDB CCL v2.0.4 (x86_64-unknown-linux-gnu, built 2018/07/16 20:25:32, go1.10) (same version as
# Cluster ID: a53dcefc-6962-451c-bacb-5661d4a6b12c
#
# Enter \? for a brief introduction.
#
warning: no current database set. Use SET database = <dbname> to change, CREATE DATABASE to make a new database.
root@localhost:26257/> show databases;
&#