当前位置:   article > 正文

linux安装Cassandra数据库_linux安装cassandra csdn

linux安装cassandra csdn

为了安全起见,建议直接上Java 1.7版本的JRE,因为Cassandra是运行于java环境之上,所以JRE是必须要安装的。不过我这里安装的是java jdk,当初也是为了省事,直接拿过来就安装的,省的下载麻烦。

开始我是用的java jdk 1.6 版本的,结果搞了好长时间都不行,最后换成1.7版本的后,就OK了。

-----------------------------------------------------------------------------------------

1> 下载Java jdk:

     下载地址:http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

     我这里用的是:jdk-7u17-linux-i586.tar.gz

     PS:这个是需要登录才能下载的,所以建议注册后,登录进去先下载到本地,然后再从本地计算机传到VM上去。

2> 下载完成后,解压jdk:

      tar -zxvf jdk-7u17-linux-i586.tar.gz

3> 解压完成后,配置环境变量:

     vim /etc/profile

     在打开的文件的末尾,增加如下代码:

  1. JAVA_HOME=/usr/local/jdk1.7.0_17
  2. PATH=$JAVA_HOME/bin:$PATH
  3. CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  4. export JAVA_HOME
  5. export PATH
  6. export CLASSPATH

PS:只需将JAVA_HOME的路径改一下即可,改成刚才解压后jdk的目录目录即可,我的是把jdk压缩包放在/usr/local目录下了,然后直接

     在这里解压的,所以解压后的包也就直接在该目录下了【jdk1.7.0_17】,所以我这里JAVA_HOME的路径为 "/usl/local/jdk1.7.0_17"

4> 上面的步骤执行完成后,执行下如下命令

     source /etc/profile

     或者重启下linux ,配置才可生效

5> 执行完上面的步骤,下一步就是看一下java jdk是否安装成功,执行下如下命令

     java -version

     我这里执行后,会输出如下内容:

  1. [root@localhost ~]# java -version
  2. java version "1.7.0_17"
  3. Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
  4. Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode)
  5. [root@localhost ~]#

说明jdk安装成功,这里的版本是1.7

支持jdk的安装到此结束,下一步是cassandra的安装

==================================================================

1> 下载Cassandra:

     地址:http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.4/apache-cassandra-1.2.4-src.tar.gz

     我这里用的版本是:apache-cassandra-1.2.4-bin.tar.gz

2> 下载完成后,直接解压:

      tar -zxvf apache-cassandra-1.2.4-bin.tar.gz

      解压完成后,得到如下目录:apache-cassandra-1.2.4

      进入该目录下的bin目录,直接启动Cassandra即可:

      cd apache-cassandra-1.2.4/bin

      ./cassandra -f 【启动cassandra】

      启动后,会输出一大堆的代码,如下,表明Cassandra启动成功:

  1. [root@localhost bin]# ./cassandra
  2. xss = -ea -javaagent:./../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms505M -Xmx505M -Xmn100M -XX:+HeapDumpOnOutOfMemoryError -Xss180k
  3. [root@localhost bin]# INFO 08:42:11,803 Logging initialized
  4. INFO 08:42:11,925 32bit JVM detected. It is recommended to run Cassandra on a 64bit JVM for better performance.
  5. INFO 08:42:11,930 JVM vendor/version: Java HotSpot(TM) Client VM/1.7.0_17
  6. INFO 08:42:11,932 Heap size: 519045120/520093696
  7. INFO 08:42:11,933 Classpath: ./../conf:./../build/classes/main:./../build/classes/thrift:./../lib/antlr-3.2.jar:./../lib/apache-cassandra-1.2.4.jar:./../lib/apache-cassandra-clientutil-1.2.4.jar:./../lib/apache-cassandra-thrift-1.2.4.jar:./../lib/avro-1.4.0-fixes.jar:./../lib/avro-1.4.0-sources-fixes.jar:./../lib/commons-cli-1.1.jar:./../lib/commons-codec-1.2.jar:./../lib/commons-lang-2.6.jar:./../lib/compress-lzf-0.8.4.jar:./../lib/concurrentlinkedhashmap-lru-1.3.jar:./../lib/guava-13.0.1.jar:./../lib/high-scale-lib-1.1.2.jar:./../lib/jackson-core-asl-1.9.2.jar:./../lib/jackson-mapper-asl-1.9.2.jar:./../lib/jamm-0.2.5.jar:./../lib/jbcrypt-0.3m.jar:./../lib/jline-1.0.jar:./../lib/json-simple-1.1.jar:./../lib/libthrift-0.7.0.jar:./../lib/log4j-1.2.16.jar:./../lib/lz4-1.1.0.jar:./../lib/metrics-core-2.0.3.jar:./../lib/netty-3.5.9.Final.jar:./../lib/servlet-api-2.5-20081211.jar:./../lib/slf4j-api-1.7.2.jar:./../lib/slf4j-log4j12-1.7.2.jar:./../lib/snakeyaml-1.6.jar:./../lib/snappy-java-1.0.4.1.jar:./../lib/snaptree-0.1.jar:./../lib/jamm-0.2.5.jar
  8. INFO 08:42:11,998 JNA not found. Native methods will be disabled.
  9. INFO 08:42:12,207 Loading settings from file:/usr/local/apache-cassandra-1.2.4/conf/cassandra.yaml
  10. INFO 08:42:13,791 Data files directories: [/var/lib/cassandra/data]
  11. INFO 08:42:13,792 Commit log directory: /var/lib/cassandra/commitlog
  12. INFO 08:42:13,793 DiskAccessMode 'auto' determined to be standard, indexAccessMode is standard
  13. INFO 08:42:13,793 disk_failure_policy is stop
  14. INFO 08:42:13,926 Global memtable threshold is enabled at 165MB
  15. INFO 08:42:15,609 Not using multi-threaded compaction
  16. INFO 08:42:17,270 Initializing key cache with capacity of 24 MBs.
  17. INFO 08:42:17,293 Scheduling key cache save to each 14400 seconds (going to save all keys).
  18. INFO 08:42:17,299 Initializing row cache with capacity of 0 MBs and provider org.apache.cassandra.cache.SerializingCacheProvider
  19. INFO 08:42:17,359 Scheduling row cache save to each 0 seconds (going to save all keys).
  20. INFO 08:42:18,249 Opening /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-ib-3 (265 bytes)
  21. INFO 08:42:18,574 Opening /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-ib-2 (220 bytes)
  22. INFO 08:42:18,597 Opening /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-ib-1 (223 bytes)
  23. INFO 08:42:18,670 Opening /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-ib-5 (4855 bytes)
  24. INFO 08:42:18,693 Opening /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-2 (3770 bytes)
  25. INFO 08:42:18,700 Opening /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-4 (208 bytes)
  26. INFO 08:42:18,706 Opening /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-3 (3772 bytes)
  27. INFO 08:42:18,713 Opening /var/lib/cassandra/data/system/schema_columns/system-schema_columns-ib-1 (3769 bytes)
  28. INFO 08:42:18,741 Opening /var/lib/cassandra/data/system/local/system-local-ib-10 (110 bytes)
  29. INFO 08:42:18,778 Opening /var/lib/cassandra/data/system/local/system-local-ib-9 (386 bytes)
  30. INFO 08:42:20,907 completed pre-loading (4 keys) key cache.
  31. INFO 08:42:20,916 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1366156865609.log, /var/lib/cassandra/commitlog/CommitLog-2-1366156865610.log
  32. INFO 08:42:20,954 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1366156865609.log
  33. INFO 08:42:21,051 Finished reading /var/lib/cassandra/commitlog/CommitLog-2-1366156865609.log
  34. INFO 08:42:21,052 Replaying /var/lib/cassandra/commitlog/CommitLog-2-1366156865610.log
  35. INFO 08:42:21,075 Finished reading /var/lib/cassandra/commitlog/CommitLog-2-1366156865610.log
  36. INFO 08:42:21,080 Enqueuing flush of Memtable-users@23457041(28/28 serialized/live bytes, 2 ops)
  37. INFO 08:42:21,085 Writing Memtable-users@23457041(28/28 serialized/live bytes, 2 ops)
  38. INFO 08:42:21,091 Enqueuing flush of Memtable-local@16277494(52/52 serialized/live bytes, 6 ops)
  39. INFO 08:42:21,146 Completed flushing /var/lib/cassandra/data/system_auth/users/system_auth-users-ib-1-Data.db (64 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=142)
  40. INFO 08:42:21,261 Writing Memtable-local@16277494(52/52 serialized/live bytes, 6 ops)
  41. INFO 08:42:21,277 Completed flushing /var/lib/cassandra/data/system/local/system-local-ib-11-Data.db (84 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=142)
  42. INFO 08:42:21,279 Log replay complete, 3 replayed mutations
  43. INFO 08:42:21,294 Fixing timestamps of schema ColumnFamily schema_keyspaces...
  44. INFO 08:42:21,495 Enqueuing flush of Memtable-local@4223809(65/65 serialized/live bytes, 2 ops)
  45. INFO 08:42:21,497 Writing Memtable-local@4223809(65/65 serialized/live bytes, 2 ops)
  46. INFO 08:42:21,513 Completed flushing /var/lib/cassandra/data/system/local/system-local-ib-12-Data.db (97 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=297)
  47. INFO 08:42:21,518 Enqueuing flush of Memtable-schema_keyspaces@11390025(389/389 serialized/live bytes, 9 ops)
  48. INFO 08:42:21,520 Writing Memtable-schema_keyspaces@11390025(389/389 serialized/live bytes, 9 ops)
  49. INFO 08:42:21,536 Completed flushing /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-ib-4-Data.db (236 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=992)
  50. INFO 08:42:21,909 Cassandra version: 1.2.4
  51. INFO 08:42:21,910 Thrift API version: 19.35.0
  52. INFO 08:42:21,911 CQL supported versions: 2.0.0,3.0.1 (default: 3.0.1)
  53. INFO 08:42:22,148 Loading persisted ring state
  54. INFO 08:42:22,151 Starting up server gossip
  55. INFO 08:42:22,222 Enqueuing flush of Memtable-local@32614666(251/251 serialized/live bytes, 9 ops)
  56. INFO 08:42:22,223 Writing Memtable-local@32614666(251/251 serialized/live bytes, 9 ops)
  57. INFO 08:42:22,238 Completed flushing /var/lib/cassandra/data/system/local/system-local-ib-13-Data.db (240 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=51235)
  58. INFO 08:42:22,269 Compacting [SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ib-12-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ib-10-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ib-9-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ib-13-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-ib-11-Data.db')]
  59. INFO 08:42:22,386 Compacted 5 sstables to [/var/lib/cassandra/data/system/local/system-local-ib-14,]. 917 bytes to 490 (~53% of original) in 63ms = 0.007417MB/s. 5 total rows, 1 unique. Row merge counts were {1:0, 2:0, 3:0, 4:0, 5:1, }
  60. INFO 08:42:22,638 Starting Messaging Service on port 7000
  61. INFO 08:42:22,943 Using saved token [-5549340944909481365]
  62. INFO 08:42:22,949 Enqueuing flush of Memtable-local@24819405(84/84 serialized/live bytes, 4 ops)
  63. INFO 08:42:22,951 Writing Memtable-local@24819405(84/84 serialized/live bytes, 4 ops)
  64. INFO 08:42:22,974 Completed flushing /var/lib/cassandra/data/system/local/system-local-ib-15-Data.db (120 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=51510)
  65. INFO 08:42:22,981 Enqueuing flush of Memtable-local@28362817(51/51 serialized/live bytes, 2 ops)
  66. INFO 08:42:22,982 Writing Memtable-local@28362817(51/51 serialized/live bytes, 2 ops)
  67. INFO 08:42:23,017 Completed flushing /var/lib/cassandra/data/system/local/system-local-ib-16-Data.db (110 bytes) for commitlog position ReplayPosition(segmentId=1366159340516, position=51685)
  68. INFO 08:42:23,093 Node localhost/127.0.0.1 state jump to normal
  69. INFO 08:42:23,100 Startup completed! Now serving reads.
  70. [root@localhost bin]#

3> 进入客户端:

      ./cassandra-cli

-------------------------------------------------------------------------------------

到此为止,linux上安装Cassandra已完成。

不足之处,望指导,谢谢。




 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/126399
推荐阅读
相关标签
  

闽ICP备14008679号