Total newbie issue

hello - (and this should be classifed under “remedial cockroach” not general)

a couple of times i have created the example bank database only to have it disappear on me when i reboot and then issue the sql command: “SHOW DATABASES;”.

Given the stellar reputation of cockroach, i can only assume i am making some sort of silly newbie error that i missed from the tutorials and documentation.

i start up cockroach simply by doing: cockroach start --background ; and sometimes i start a second node as well.

is there a simple command outside of SQL to show me where all my databases might be? i assume i need to maybe add another flag-switch or something like that.

UPDATE:

By default, cockroach stores its data in the cockroach-data subdirectory of wherever you run it. Are you perhaps starting from different directories at different times? If so, give it the --store=/some/path flag to tell it where to find the data.

A newly started node will print its data directory (or directories) on the lines starting with store (and the status line will tell you whether it found existing data or started from scratch):

$ work/cockroach/bin/cockroach start
CockroachDB node starting at 2017-04-08 14:42:42.93928943 -0400 EDT
build:      CCL 4210a5e0c @ 2017/04/04 01:15:49 (go1.8)
admin:      http://localhost:8080
sql:        postgresql://root@localhost:26257?sslmode=disable
logs:       cockroach-data/logs
store[0]:   path=cockroach-data
status:     restarted pre-existing node
clusterID:  f87daee5-e48b-488c-8fe9-fe933cba9ceb
nodeID:     1
1 Like

It’s not a huge deal, but I imagine it’d be more clear if we printed the absolute path to the store rather than the relative path.

1 Like

Added the printing of absolute paths here: https://github.com/cockroachdb/cockroach/pull/14746

1 Like