I have setup CockroachDB according to the instructions at https://www.cockroachlabs.com/docs/stable/deploy-cockroachdb-on-premises-insecure.html. However, SQL queries take too long time and do not respond.
The procedure of setupping cluster is as follows. I used three machines running Ubuntu 19.10.
At node1
cockroach start --insecure --advertise-addr=${NODE1} --join=${NODE1},${NODE2},${NODE3} --cache=.25 --max-sql-memory=.25 --background
At node2
cockroach start --insecure --advertise-addr=${NODE2} --join=${NODE1},${NODE2},${NODE3} --cache=.25 --max-sql-memory=.25 --background
At node3
cockroach start --insecure --advertise-addr=${NODE3} --join=${NODE1},${NODE2},${NODE3} --cache=.25 --max-sql-memory=.25 --background
Here, ${NODEi} stands for the address of each node.
Then, I initialized the cluster.
cockroach init --insecure --host=${NODE1}
After that, I went into SQL shell and typed a query.
#
# Welcome to the CockroachDB SQL shell.
# All statements must be terminated by a semicolon.
# To exit, type: \q.
#
# Server version: CockroachDB CCL v20.1.1 (x86_64-unknown-linux-gnu, built 2020/05/19 14:46:06, go1.13.9) (same version as client)
# Cluster ID: 77cf3b29-f895-45ab-9592-7956a3effdb7
#
# Enter \? for a brief introduction.
#
root@192.168.10.131:26257/defaultdb> CREATE DATABASE bank;
The command CREATE DATABASE bank
took more than one minute and seemed not to work. But when I try again later, the same command finished within a second.
The status of cluster is as follows:
id | address | sql_address | build | started_at | updated_at | locality | is_available | is_live
-----+----------------------+----------------------+---------+----------------------------------+----------------------------------+----------+--------------+----------
1 | 192.168.10.131:26257 | 192.168.10.131:26257 | v20.1.1 | 2020-05-28 05:00:17.725807+00:00 | 2020-05-28 05:26:01.338089+00:00 | | true | true
2 | 192.168.10.132:26257 | 192.168.10.132:26257 | v20.1.1 | 2020-05-28 05:00:18.574806+00:00 | 2020-05-28 05:26:02.121931+00:00 | | true | true
3 | 192.168.10.133:26257 | 192.168.10.133:26257 | v20.1.1 | 2020-05-28 05:00:18.729008+00:00 | 2020-05-28 05:26:02.253278+00:00 | | true | true
(3 rows)
Do you have any ideas to solve this problem?