Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cassandra Keyspace and table not loaded on startup #12

Open
cpurta opened this issue Oct 23, 2020 · 0 comments
Open

Cassandra Keyspace and table not loaded on startup #12

cpurta opened this issue Oct 23, 2020 · 0 comments
Assignees
Labels
bug Something isn't working difficulty:medium Work should be medium intensity to complete

Comments

@cpurta
Copy link
Owner

cpurta commented Oct 23, 2020

When starting up tatanka in the docker-compose environment it is unable to successfully run due to the 'tatanka' keyspace not being present when attempting to connect:

$ docker-compose -f ./docker/docker-compose.yml run tatanka
2020/10/23 19:16:26 error: failed to connect to 172.20.0.2:9042 due to error: Keyspace 'tatanka' does not exist
2020/10/23 19:16:26 error: failed to connect to 172.20.0.2:9042 due to error: Keyspace 'tatanka' does not exist
error running program: unable to connect to cassandra cluster: no connections were made when creating the session

This is because the Cassandra container does not have the keyspace and trades table created. We need to have the keyspace and trade table create on startup. This can be circumvented by exec'ing onto the cassandra contain with cqlsh and creating the keyspace and table. i.e.

$ docker exec -it docker_cassandra_1 cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 4.0-beta2 | CQL spec 3.4.5 | Native protocol v4]
Use HELP for help.
cqlsh> CREATE KEYSPACE IF NOT EXISTS tatanka WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 1};
cqlsh> CREATE TABLE tatanka.trades (     id uuid PRIMARY KEY,     selector text,     trade_id text,     price double,     size double,     time timestamp,     side text );

Looking into this is appears that we can use a different docker image to get the keyspace and table to load by mounting a cql scripts into a directory: docker-library/cassandra#104

Or we can probably just manually build an image with cassandra and the keyspace and table loaded.

@cpurta cpurta added bug Something isn't working difficulty:medium Work should be medium intensity to complete labels Oct 23, 2020
@cpurta cpurta self-assigned this Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working difficulty:medium Work should be medium intensity to complete
Projects
None yet
Development

No branches or pull requests

1 participant