Cassandra: Difference between revisions
Jump to navigation
Jump to search
Created page with "=Introduction= Haven't done much with this, made by Apache and is a distributed. =Docker= I my case I put this in a docker-compose. Here is the yaml <syntaxhighlight lang="ya..." |
|||
(One intermediate revision by the same user not shown) | |||
Line 32: | Line 32: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=Client= | =Client= | ||
==CLI== | |||
Finding the client was not as easy as usual. You need to install pip3 and then install cqlsh using pip3 | Finding the client was not as easy as usual. You need to install pip3 and then install cqlsh using pip3 | ||
==VSCode== | |||
There is a plugin for VS Code too.<br> | |||
[[File:VSCode Cassandra.png|300px]] | |||
=Usage= | =Usage= | ||
Not done much but here is my example | Not done much but here is my example | ||
Line 39: | Line 44: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
And create a table | And create a table | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="cql"> | ||
create KEYSPACE oauth WITH REPLICATION ={'class': 'SimpleStrategy', 'repliaction_factor' :1 }; | create KEYSPACE oauth WITH REPLICATION ={'class': 'SimpleStrategy', 'repliaction_factor' :1 }; | ||
USE oauth; | USE oauth; | ||
create TABLE access_tokens(access_token VARCHAR PRIMARY KEY, user_id BIGINT, client_id BIGINT, expires BIGINT); | create TABLE access_tokens(access_token VARCHAR PRIMARY KEY, user_id BIGINT, client_id BIGINT, expires BIGINT); | ||
SELECT * FROM access_tokens WHERE access_token = 'fred'; | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 04:48, 30 September 2021
Introduction
Haven't done much with this, made by Apache and is a distributed.
Docker
I my case I put this in a docker-compose. Here is the yaml
version: '2'
services:
cassandra:
image: docker.io/bitnami/cassandra:4.0
ports:
- '7000:7000'
- '9042:9042'
volumes:
- /home/iwiseman/dev/cassandra/data/cassandra-persistence:/bitnami
environment:
- BITNAMI_DEBUG=true
- CASSANDRA_SEEDS=cassandra
- CASSANDRA_PASSWORD_SEEDER=yes
- CASSANDRA_PASSWORD=notpasswordorthis
volumes:
cassandra_data:
driver: local
I had to faff around with the permissions for it to start to. I just did
mkdir -p data/cassandra1/commitlog
mkdir -p data/cassandra1/saved_caches
mkdir -p data/cassandra1/data
mkdir -p data/cassandra1/hints
chmod -R 777 data
Client
CLI
Finding the client was not as easy as usual. You need to install pip3 and then install cqlsh using pip3
VSCode
There is a plugin for VS Code too.
Usage
Not done much but here is my example
cqlsh localhost -u cassandra -p stillnotpasswordorthis
And create a table
create KEYSPACE oauth WITH REPLICATION ={'class': 'SimpleStrategy', 'repliaction_factor' :1 };
USE oauth;
create TABLE access_tokens(access_token VARCHAR PRIMARY KEY, user_id BIGINT, client_id BIGINT, expires BIGINT);
SELECT * FROM access_tokens WHERE access_token = 'fred';