CockroachDB サンプルデータベース作成

OS: Rocky Linux 9


-- 1. インストール

wget -qO- https://binaries.cockroachdb.com/cockroach-v19.2.4.linux-amd64.tgz | tar xvz
cp -i cockroach-v19.2.4.linux-amd64/cockroach /usr/local/bin/


-- 2. DB起動

cockroach start-single-node --insecure --listen-addr=localhost &


-- 3. サンプルデータベース作成

 

cockroach workload init bank postgresql://root@127.0.0.1:26257?sslmode=disable
cockroach workload run bank  --duration 60s  postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init intro postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init kv postgresql://root@127.0.0.1:26257?sslmode=disable
cockroach workload run kv  --duration 60s  postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init movr postgresql://root@127.0.0.1:26257?sslmode=disable
cockroach workload run movr  --duration 60s postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init startrek postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init tpcc postgresql://root@127.0.0.1:26257?sslmode=disable
cockroach workload run tpcc --duration 60s postgresql://root@127.0.0.1:26257?sslmode=disable

cockroach workload init ycsb postgresql://root@127.0.0.1:26257?sslmode=disable
cockroach workload run ycsb --duration 60s   postgresql://root@127.0.0.1:26257?sslmode=disable

 

 

-- 4. データ確認

cockroach sql --insecure

show databases;

use startrek;

show tables;

\d episodes;

select * from episodes limit 1;