Child pages
  • Cassandra kezdő lépések

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
# adduser -g users -m cassandra
# su - cassandra
$ wget http://xenia.sote.hu/ftp/mirrors/www.apache.org/cassandra/2.0.9/apache-cassandra-2.0.9-bin.tar.gz
$ tar xzvf apache-cassandra-2.0.9-bin.tar.gz
# mkdir /var/lib/cassandra/
# chown cassandra:users /var/lib/cassandra/
# mkdir /var/log/cassandra/
# chown cassandra:users /var/log/cassandra/
# mkdir /var/run/cassandra
# chown cassandra:users /var/run/cassandra

 

Egy kicsit szerkesztünk a konfigurációs állományon, ahol meg kell adni azokat a gépneveket vagy IP címeket, amelyeken a SEED szerverek fognak futni:

...

Code Block
$ apache-cassandra-2.0.69/bin/cassandra -f
 INFO 15:39:19,534 Logging initialized
 INFO 15:39:19,595 Loading settings from file:/home/cassandra/apache-cassandra-2.0.69/conf/cassandra.yaml
 INFO 15:39:20,316 Data files directories: [/var/lib/cassandra/data]
 INFO 15:39:20,317 Commit log directory: /var/lib/cassandra/commitlog
 INFO 15:39:20,317 DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap
 INFO 15:39:20,318 disk_failure_policy is stop
 INFO 15:39:20,318 commit_failure_policy is stop
 INFO 15:39:20,327 Global memtable threshold is enabled at 59MB
 INFO 15:39:20,539 Not using multi-threaded compaction
 INFO 15:39:21,028 JVM vendor/version: OpenJDK 64-Bit Server VM/1.7.0_51
...
 INFO 15:39:32,566 No gossip backlog; proceeding
 INFO 15:39:32,789 Starting listening for CQL clients on gacivs-test02/10.129.215.37:9042...
 INFO 15:39:32,919 Using TFramedTransport with a max frame size of 15728640 bytes.
 INFO 15:39:32,921 Binding thrift service to gacivs-test02/10.129.215.37:9160
 INFO 15:39:32,933 Using synchronous/threadpool thrift server on gacivs-test02 : 9160
 INFO 15:39:32,934 Listening for thrift clients...

...

Code Block
$ apache-cassandra-2.0.69/bin/nodetool -host gacivs02 -p 7199 status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load       Tokens  Owns (effective)  Host ID                               Rack
UN  10.129.215.37  40.85 KB   256     100.0%            db1a6512-a215-4fef-8f92-d858fb4cb8f2  rack1
UN  10.129.216.43  57.15 KB   256     100.0%            1aa61570-52f2-49e5-8a2a-dee9a9845638  rack1

...

Code Block
$ apache-cassandra-2.0.69/bin/cqlsh gacivs-test01
Connected to gacivs at gacivs-test01:9160.
[cqlsh 4.1.1 | Cassandra 2.0.69 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.
cqlsh>
cqlsh> CREATE KEYSPACE test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };
cqlsh>
cqlsh> USE test;
cqlsh:test>
cqlsh:test> CREATE TABLE test ( id int PRIMARY KEY, subject text, description text );
cqlsh:test>

...