Friday, January 04, 2013

Cassandra - learn #1

I read my google reader. I found Apache announced Apache Cassandra 1.2.0. However, I am interested in Cassandra a bit and not know much. So, this article I used "learn" word because I just installed and testes a bit. I chose CentOs 6.3 :)
- Installed jdk 1.6. I tested to use java(OpenJDK). I found "Segmentation fault".
[root@centos ~]# chmod 750 jdk-6u38-linux-x64-rpm.bin
[root@centos ~]# ./jdk-6u38-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u38-linux-amd64.rpm
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

Done.
[root@centos ~]#
- Downloaded Cassandra and start it
Note: Ensure profile to use new java and set hosts file.
[surachart@centos ~]$ tar zxf apache-cassandra-1.2.0-bin.tar.gz
[surachart@centos ~]$ cd apache-cassandra-1.2.0
[surachart@centos apache-cassandra-1.2.0]$ vi README.txt
[surachart@centos apache-cassandra-1.2.0]$ sudo mkdir -p /var/log/cassandra
[surachart@centos apache-cassandra-1.2.0]$ sudo chown -R `whoami` /var/log/cassandra
[surachart@centos apache-cassandra-1.2.0]$ sudo mkdir -p /var/lib/cassandra
[surachart@centos apache-cassandra-1.2.0]$ sudo chown -R `whoami` /var/lib/cassandra

[surachart@centos apache-cassandra-1.2.0]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.111.80  centos  centos.surachartopun.com

[surachart@centos apache-cassandra-1.2.0]$ type java
java is /usr/java/default/bin/java
[surachart@centos apache-cassandra-1.2.0]$ java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
[surachart@centos apache-cassandra-1.2.0]$
[surachart@centos apache-cassandra-1.2.0]$  bin/cassandra -f
xss =  -ea -javaagent:bin/../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms938M -Xmx938M -Xmn100M -XX:+HeapDumpOnOutOfMemoryError -Xss180k
 INFO 19:12:44,521 Logging initialized
 INFO 19:12:44,612 JVM vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.6.0_38
 INFO 19:12:44,613 Heap size: 973078528/973078528
 INFO 19:12:44,614 Classpath: bin/../conf:bin/../build/classes/main:bin/../build/classes/thrift:bin/../lib/antlr-3.2.jar:bin/../lib/apache-cassandra-1.2.0.jar:bin/../lib/apache-cassandra-clientutil-1.2.0.jar:bin/../lib/apache-cassandra-thrift-1.2.0.jar:bin/../lib/avro-1.4.0-fixes.jar:bin/../lib/avro-1.4.0-sources-fixes.jar:bin/../lib/commons-cli-1.1.jar:bin/../lib/commons-codec-1.2.jar:bin/../lib/commons-lang-2.6.jar:bin/../lib/compress-lzf-0.8.4.jar:bin/../lib/concurrentlinkedhashmap-lru-1.3.jar:bin/../lib/guava-13.0.1.jar:bin/../lib/high-scale-lib-1.1.2.jar:bin/../lib/jackson-core-asl-1.9.2.jar:bin/../lib/jackson-mapper-asl-1.9.2.jar:bin/../lib/jamm-0.2.5.jar:bin/../lib/jline-1.0.jar:bin/../lib/json-simple-1.1.jar:bin/../lib/libthrift-0.7.0.jar:bin/../lib/log4j-1.2.16.jar:bin/../lib/metrics-core-2.0.3.jar:bin/../lib/netty-3.5.9.Final.jar:bin/../lib/servlet-api-2.5-20081211.jar:bin/../lib/slf4j-api-1.7.2.jar:bin/../lib/slf4j-log4j12-1.7.2.jar:bin/../lib/snakeyaml-1.6.jar:bin/../lib/snappy-java-1.0.4.1.jar:bin/../lib/snaptree-0.1.jar:bin/../lib/jamm-0.2.5.jar
 INFO 19:12:44,621 JNA not found. Native methods will be disabled.
 INFO 19:12:44,664 Loading settings from file:/home/surachart/apache-cassandra-1.2.0/conf/cassandra.yaml
 INFO 19:12:46,548 DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap
 INFO 19:12:46,550 disk_failure_policy is stop
 INFO 19:12:46,565 Global memtable threshold is enabled at 309MB
 INFO 19:12:50,326 Initializing key cache with capacity of 46 MBs.
 INFO 19:12:50,375 Scheduling key cache save to each 14400 seconds (going to save all keys).
 INFO 19:12:50,379 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider
 INFO 19:12:50,413 Scheduling row cache save to each 0 seconds (going to save all keys).
 INFO 19:12:51,332 Opening /var/lib/cassandra/data/system/local/system-local-ia-5 (448 bytes)
 INFO 19:12:52,001 Couldn't detect any schema definitions in local storage.
 INFO 19:12:52,006 Found table data in data directories. Consider using the CLI to define your schema.
 INFO 19:12:52,502 completed pre-loading (1 keys) key cache.
 INFO 19:12:52,577 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1357214890686.log, /var/lib/cassandra/commitlog/CommitLog-2-1357214890687.log
 INFO 19:12:52,675 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1357214890686.log
 INFO 19:12:53,455 Finished reading /var/lib/cassandra/commitlog/CommitLog-2-1357214890686.log
 INFO 19:12:53,455 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1357214890687.log
 INFO 19:12:53,464 Finished reading /var/lib/cassandra/commitlog/CommitLog-2-1357214890687.log
 INFO 19:12:53,891 Enqueuing flush of Memtable-local@1458621244(52/52 serialized/live bytes, 2 ops)
 INFO 19:12:53,936 Writing Memtable-local@1458621244(52/52 serialized/live bytes, 2 ops)
 INFO 19:12:53,963 Enqueuing flush of Memtable-schema_keyspaces@64676192(389/389 serialized/live bytes, 12 ops)
 INFO 19:12:53,965 Enqueuing flush of Memtable-schema_columns@386033562(21317/21317 serialized/live bytes, 328 ops)
 INFO 19:12:53,971 Enqueuing flush of Memtable-schema_columnfamilies@1920940938(20754/20754 serialized/live bytes, 344 ops)
 INFO 19:12:53,977 Enqueuing flush of Memtable-users@2132679615(28/28 serialized/live bytes, 2 ops)
 INFO 19:12:54,068 Completed flushing /var/lib/cassandra/data/system/local/system-local-ia-6-Data.db (84 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=142)
 INFO 19:12:54,113 Writing Memtable-schema_keyspaces@64676192(389/389 serialized/live bytes, 12 ops)
 INFO 19:12:54,167 Completed flushing /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-ia-1-Data.db (265 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=142)
 INFO 19:12:54,170 Writing Memtable-schema_columns@386033562(21317/21317 serialized/live bytes, 328 ops)
 INFO 19:12:54,264 Completed flushing /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ia-1-Data.db (3765 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=142)
 INFO 19:12:54,268 Writing Memtable-schema_columnfamilies@1920940938(20754/20754 serialized/live bytes, 344 ops)
 INFO 19:12:54,340 Completed flushing /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-ia-1-Data.db (4449 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=142)
 INFO 19:12:54,342 Writing Memtable-users@2132679615(28/28 serialized/live bytes, 2 ops)
 INFO 19:12:54,386 Completed flushing /var/lib/cassandra/data/system_auth/users/system_auth-users-ia-1-Data.db (72 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=142)
 INFO 19:12:54,389 Log replay complete, 19 replayed mutations
 INFO 19:12:55,555 Cassandra version: 1.2.0
 INFO 19:12:55,555 Thrift API version: 19.35.0
 INFO 19:12:55,559 CQL supported versions: 2.0.0,3.0.0 (default: 3.0.0)
 INFO 19:12:55,775 Loading persisted ring state
 INFO 19:12:55,796 Starting up server gossip
 INFO 19:12:55,855 Enqueuing flush of Memtable-local@737736904(251/251 serialized/live bytes, 9 ops)
 INFO 19:12:55,856 Writing Memtable-local@737736904(251/251 serialized/live bytes, 9 ops)
 INFO 19:12:56,018 Completed flushing /var/lib/cassandra/data/system/local/system-local-ia-7-Data.db (238 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=48998)
 INFO 19:12:56,245 Starting Messaging Service on port 7000
 INFO 19:12:56,328 Using saved token [3339682839163339854]
 INFO 19:12:56,336 Enqueuing flush of Memtable-local@1842275169(84/84 serialized/live bytes, 4 ops)
 INFO 19:12:56,338 Writing Memtable-local@1842275169(84/84 serialized/live bytes, 4 ops)
 INFO 19:12:56,467 Completed flushing /var/lib/cassandra/data/system/local/system-local-ia-8-Data.db (120 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=49273)
 INFO 19:12:56,486 Enqueuing flush of Memtable-local@1854861687(50/50 serialized/live bytes, 2 ops)
 INFO 19:12:56,491 Writing Memtable-local@1854861687(50/50 serialized/live bytes, 2 ops)
 INFO 19:12:56,529 Compacting [SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ia-5-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ia-7-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ia-6-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ia-8-Data.db')]
 INFO 19:12:56,576 Completed flushing /var/lib/cassandra/data/system/local/system-local-ia-9-Data.db (108 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=49447)
 INFO 19:12:56,666 Node localhost/127.0.0.1 state jump to normal
 INFO 19:12:56,722 Enqueuing flush of Memtable-local@995807706(50/50 serialized/live bytes, 2 ops)
 INFO 19:12:56,724 Writing Memtable-local@995807706(50/50 serialized/live bytes, 2 ops)
 INFO 19:12:56,823 Completed flushing /var/lib/cassandra/data/system/local/system-local-ia-10-Data.db (108 bytes) for commitlog position ReplayPosition(segmentId=1357215172266, position=49621)
 INFO 19:12:56,828 Startup completed! Now serving reads.
 INFO 19:12:57,027 Not starting native transport as requested. Use JMX (StorageService->startNativeTransport()) to start it
 INFO 19:12:57,059 Binding thrift service to localhost/127.0.0.1:9160
 INFO 19:12:57,160 Compacted to [/var/lib/cassandra/data/system/local/system-local-ia-11-Data.db,].  890 to 427 (~47% of original) bytes for 1 keys at 0.000722MB/s.  Time: 564ms.
 INFO 19:12:57,228 Using TFramedTransport with a max frame size of 15728640 bytes.
 INFO 19:12:57,248 Using synchronous/threadpool thrift server on localhost : 9160
 INFO 19:12:57,251 Listening for thrift clients...
It looks good, then test...

No comments: