码迷,mamicode.com
首页 > 其他好文 > 详细

在已经安装好spark的docker镜像里安装cassandra2.0.7

时间:2015-03-02 13:10:29      阅读:583      评论:0      收藏:0      [点我收藏+]

标签:cassandra   docer   

1. 通过docker run命令的-v/–volume参数将主机文件拷贝到docker容器

[root@master ~]# docker run -v /data:/mnt -i -t -P -h sandbox sequenceiq/spark:1.2.0 /etc/bootstrap.sh -bash
/
Starting sshd:                                             [  OK  ]
Starting namenodes on [sandbox]
sandbox: starting namenode, logging to /usr/local/hadoop/logs/hadoop-root-namenode-sandbox.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-root-datanode-sandbox.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-root-secondarynamenode-sandbox.out
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn--resourcemanager-sandbox.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-root-nodemanager-sandbox.out
bash-4.1# pwd
/
bash-4.1# cd data
bash-4.1# ls
apache-cassandra-2.0.7  apache-cassandra-2.0.7-bin.tar.gz

2. 下载完成后,直接解压

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

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

3.启动cassandra

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

cd apache-cassandra-2.0.7/bin
./cassandra -f 

启动后,会输出一大堆的代码,如下,表明Cassandra启动成功:
INFO 23:35:46,454 Logging initialized
INFO 23:35:46,558 Loading settings from file:/root/apache-cassandra-2.0.7/conf/cassandra.yaml
INFO 23:35:47,105 Data files directories: [/var/lib/cassandra/data]
INFO 23:35:47,106 Commit log directory: /var/lib/cassandra/commitlog
INFO 23:35:47,106 DiskAccessMode ‘auto’ determined to be mmap, indexAccessMode is mmap
INFO 23:35:47,107 disk_failure_policy is stop
INFO 23:35:47,107 commit_failure_policy is stop
INFO 23:35:47,142 Global memtable threshold is enabled at 360MB
INFO 23:35:47,481 Not using multi-threaded compaction
INFO 23:35:47,863 JVM vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.7.0_51
INFO 23:35:47,863 Heap size: 1509949440/1509949440
INFO 23:35:47,863 Code Cache Non-heap memory: init = 2555904(2496K) used = 649216(634K) committed = 2555904(2496K) max = 50331648(49152K)
INFO 23:35:47,864 Par Eden Space Heap memory: init = 167772160(163840K) used = 57187000(55846K) committed = 167772160(163840K) max = 167772160(163840K)
INFO 23:35:47,864 Par Survivor Space Heap memory: init = 20971520(20480K) used = 0(0K) committed = 20971520(20480K) max = 20971520(20480K)
INFO 23:35:47,864 CMS Old Gen Heap memory: init = 1321205760(1290240K) used = 0(0K) committed = 1321205760(1290240K) max = 1321205760(1290240K)
INFO 23:35:47,864 CMS Perm Gen Non-heap memory: init = 21757952(21248K) used = 14225008(13891K) committed = 21757952(21248K) max = 85983232(83968K)
INFO 23:35:47,868 Classpath: ./../conf:./../build/classes/main:./../build/classes/thrift:./../lib/antlr-3.2.jar:./../lib/apache-cassandra-2.0.7.jar:./../lib/apache-cassandra-clientutil-2.0.7.jar:./../lib/apache-cassandra-thrift-2.0.7.jar:./../lib/commons-cli-1.1.jar:./../lib/commons-codec-1.2.jar:./../lib/commons-lang3-3.1.jar:./../lib/compress-lzf-0.8.4.jar:./../lib/concurrentlinkedhashmap-lru-1.3.jar:./../lib/disruptor-3.0.1.jar:./../lib/guava-15.0.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.9.1.jar:./../lib/log4j-1.2.16.jar:./../lib/lz4-1.2.0.jar:./../lib/metrics-core-2.2.0.jar:./../lib/netty-3.6.6.Final.jar:./../lib/reporter-config-2.1.0.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.11.jar:./../lib/snappy-java-1.0.5.jar:./../lib/snaptree-0.1.jar:./../lib/super-csv-2.1.0.jar:./../lib/thrift-server-0.3.3.jar:./../lib/jamm-0.2.5.jar
INFO 23:35:47,870 JNA not found. Native methods will be disabled.
INFO 23:35:47,898 Initializing key cache with capacity of 72 MBs.
INFO 23:35:47,910 Scheduling key cache save to each 14400 seconds (going to save all keys).
INFO 23:35:47,915 Initializing row cache with capacity of 0 MBs
INFO 23:35:47,929 Scheduling row cache save to each 0 seconds (going to save all keys).
INFO 23:35:48,083 Initializing system.schema_triggers
INFO 23:35:48,116 Initializing system.compaction_history
INFO 23:35:48,122 Initializing system.batchlog
INFO 23:35:48,128 Initializing system.sstable_activity
INFO 23:35:48,134 Initializing system.peer_events
INFO 23:35:48,143 Initializing system.compactions_in_progress
INFO 23:35:48,149 Initializing system.hints
INFO 23:35:48,156 Initializing system.schema_keyspaces
INFO 23:35:48,171 Opening /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-jb-1 (217 bytes)
INFO 23:35:48,241 Initializing system.range_xfers
INFO 23:35:48,247 Initializing system.schema_columnfamilies
INFO 23:35:48,249 Opening /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-1 (5720 bytes)
INFO 23:35:48,271 Initializing system.NodeIdInfo
INFO 23:35:48,278 Initializing system.paxos
INFO 23:35:48,285 Initializing system.schema_columns
INFO 23:35:48,296 Opening /var/lib/cassandra/data/system/schema_columns/system-schema_columns-jb-1 (10181 bytes)
INFO 23:35:48,316 Initializing system.IndexInfo
INFO 23:35:48,330 Initializing system.peers
INFO 23:35:48,348 Initializing system.local
INFO 23:35:48,354 Opening /var/lib/cassandra/data/system/local/system-local-jb-5 (5666 bytes)
INFO 23:35:49,199 Enqueuing flush of Memtable-local@2077961571(114/1140 serialized/live bytes, 3 ops)
INFO 23:35:49,202 Writing Memtable-local@2077961571(114/1140 serialized/live bytes, 3 ops)
INFO 23:35:49,256 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-6-Data.db (139 bytes) for commitlog position ReplayPosition(segmentId=1425270949016, position=271)
INFO 23:35:49,275 Initializing system_traces.sessions
INFO 23:35:49,281 Initializing system_traces.events
INFO 23:35:49,282 completed pre-loading (3 keys) key cache.
INFO 23:35:49,295 Replaying /var/lib/cassandra/commitlog/CommitLog-3-1425270317620.log, /var/lib/cassandra/commitlog/CommitLog-3-1425270317621.log
INFO 23:35:49,328 Replaying /var/lib/cassandra/commitlog/CommitLog-3-1425270317620.log (CL version 3, messaging version 7)
INFO 23:35:49,409 Finished reading /var/lib/cassandra/commitlog/CommitLog-3-1425270317620.log
INFO 23:35:49,410 Replaying /var/lib/cassandra/commitlog/CommitLog-3-1425270317621.log (CL version 3, messaging version 7)
INFO 23:35:49,413 Finished reading /var/lib/cassandra/commitlog/CommitLog-3-1425270317621.log
INFO 23:35:49,414 Enqueuing flush of Memtable-compaction_history@1651318690(253/2530 serialized/live bytes, 9 ops)
INFO 23:35:49,416 Writing Memtable-compaction_history@1651318690(253/2530 serialized/live bytes, 9 ops)
INFO 23:35:49,453 Completed flushing /var/lib/cassandra/data/system/compaction_history/system-compaction_history-jb-1-Data.db (237 bytes) for commitlog position ReplayPosition(segmentId=1425270949016, position=271)
INFO 23:35:49,454 Log replay complete, 1 replayed mutations
INFO 23:35:49,582 CFS(Keyspace=’system’, ColumnFamily=’schema_columnfamilies’) liveRatio is 6.759617682198328 (just-counted was 3.5192353643966547). calculation took 9ms for 75 cells
INFO 23:35:49,598 CFS(Keyspace=’system’, ColumnFamily=’schema_columns’) liveRatio is 5.964539007092198 (just-counted was 1.929078014184397). calculation took 9ms for 119 cells
INFO 23:35:49,654 CFS(Keyspace=’system’, ColumnFamily=’schema_columns’) liveRatio is 4.276033289389291 (just-counted was 2.5875275716863846). calculation took 39ms for 175 cells
INFO 23:35:49,690 CFS(Keyspace=’system’, ColumnFamily=’schema_columnfamilies’) liveRatio is 4.505972149345502 (just-counted was 2.252326616492676). calculation took 35ms for 200 cells
INFO 23:35:49,738 CFS(Keyspace=’system’, ColumnFamily=’schema_columns’) liveRatio is 3.629785323462058 (just-counted was 2.983537357534825). calculation took 47ms for 343 cells
INFO 23:35:49,797 CFS(Keyspace=’system’, ColumnFamily=’schema_columnfamilies’) liveRatio is 3.6720422118853566 (just-counted was 2.8381122744252116). calculation took 8ms for 300 cells
INFO 23:35:49,853 CFS(Keyspace=’system’, ColumnFamily=’schema_columns’) liveRatio is 3.223828707676712 (just-counted was 2.8178720918913656). calculation took 17ms for 679 cells
INFO 23:35:50,117 CFS(Keyspace=’system’, ColumnFamily=’schema_columnfamilies’) liveRatio is 3.5851290221041197 (just-counted was 3.4982158323228822). calculation took 8ms for 450 cells
INFO 23:35:50,159 Cassandra version: 2.0.7
INFO 23:35:50,159 Thrift API version: 19.39.0
INFO 23:35:50,188 CQL supported versions: 2.0.0,3.1.5 (default: 3.1.5)
INFO 23:35:50,197 CFS(Keyspace=’system’, ColumnFamily=’schema_columns’) liveRatio is 3.5635458012296675 (just-counted was 3.5635458012296675). calculation took 35ms for 854 cells
INFO 23:35:50,227 Loading persisted ring state
INFO 23:35:50,281 Starting up server gossip
INFO 23:35:50,311 Enqueuing flush of Memtable-local@1365425140(286/2860 serialized/live bytes, 10 ops)
INFO 23:35:50,312 Writing Memtable-local@1365425140(286/2860 serialized/live bytes, 10 ops)
INFO 23:35:50,351 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-7-Data.db (263 bytes) for commitlog position ReplayPosition(segmentId=1425270949016, position=173666)
INFO 23:35:50,473 Starting Messaging Service on port 7000
INFO 23:35:50,524 Using saved tokens [-1031287545638612613, -1036841837584881574, -1128404595725678247, -1189277521808554619, -1282922425597708042, -1359212988783235047, -1492988743594385881, -1503560445644319517, -1504382950887598473, -1530343719689667531, -1542231821535299219, -1548491787721247317, -1616876032649504986, -1639071622803567816, -1657966738048630243, -1678208424719793021, -1815639897204338727, -1815802039474823548, -1858560061762131837, -1936779998892402581, -1957158329564851827, -1978802954321649942, -2037235685946519697, -2328149266386525010, -2338206739955540141, -2618263326007508742, -2738412674734796969, -2776170492483287574, -2887832188375469456, -2909726048755195264, -3024931952100110257, -3057314694596330023, -3060638045063031171, -3191996664773394631, -3206947773368564975, -3286858987848144817, -3386441950374305952, -3433688549173562990, -3494489777131069389, -3639818767383330358, -3645113660408678865, -3762108881235804183, -3767866349758288155, -3814368303553640570, -3839614887044870754, -3904522085415255822, -3999793778347548614, -4003575091291493495, -4011359414680046002, -4208605140144239842, -4224974539117832132, -4330166475701685150, -4357321203977813220, -4363087932924907613, -4410011016585665690, -4444223430589027444, -4464871252743099467, -4517168990558460098, -4542942499632808757, -4688411626758405309, -4791069038800964450, -485435593363708338, -4872088997001709878, -4873866434803934925, -4910105086916245968, -5020677621453729712, -503112462125904516, -5140738907944711093, -5188203349617972505, -5274082868081345780, -5326488218637190129, -5377003032614184190, -5428526761558622616, -5452457481980603738, -5490434153881461599, -55275100770297479, -5608245201710070130, -5706518816166025400, -5882479516716902041, -5956699381284441478, -5972163100535946876, -6023138347472967927, -6023478349228186306, -6047993580883033591, -6126789568412447434, -6132909990869706829, -6226949953824349720, -6286306012833387608, -6319601831114795322, -6371905356664984613, -6433539674550854133, -665530573641005825, -666780331290758793, -6765552255085765722, -6824981148841026677, -6847842414091414478, -6851245765388753036, -6934154100475101287, -6946051925541053786, -7077072450704888031, -7126086172903683112, -7192503008940466431, -7238134164297721197, -7250331954852160228, -728236540034994038, -7284932359239353689, -7331523023032339133, -733388382398755314, -735260676788644893, -7486743018367679639, -757009650401451157, -7603693892940008128, -7739656486413963980, -776693212371533309, -7789476201346916196, -7812262131829153251, -7822030374461399595, -7833988572707250780, -7864378073100479637, -7881469576940298903, -794405752334849166, -8058243503627205344, -8103397952178764724, -8124030349258479882, -8143085627660811312, -8255358280932952903, -8415751687505719718, -8433985033101831552, -8459340852917205328, -850098136299025134, -8545057470827143795, -8569718987924567805, -8582623730283690769, -8604714277395566714, -8608416991526152185, -8696498953083556264, -9008526813158184152, -9091099727292946194, -9165706865855047431, -932541008924465050, -981066099090448070, 1176772617345591675, 1292518989726482100, 1333398140481842920, 1412995305493388778, 1429882836621458928, 1548687686075048078, 1605001762546824631, 1611129021621158654, 1617119483322232667, 164664084335778746, 1774294036374908493, 1821140189533860756, 1834246116328260917, 1855618981325207059, 1866988399728488841, 1908029389442441180, 200260887573312220, 201025490471289485, 2010990552248226664, 2254377642132214434, 2479593880696794862, 2509237923128530640, 2621579588565667976, 2661393282243859557, 2666493263773847796, 2699468873602180754, 2711306665717618919, 271943550402440687, 2783952023817934110, 2815625735892885431, 2875705254998850479, 2901240565802935952, 2927073587765412070, 2962630008726023095, 3253194579942245522, 326439362694771422, 3287290778094570547, 34131193250988584, 3480474033423140048, 3572680030022508131, 3666616955598841753, 3747771802033949415, 378127683434495493, 3816417711595759122, 3839677752507026947, 3877555615295767340, 4011640113576038205, 403456556248717174, 4319895014178194550, 4371392683302492937, 4400807570815199785, 4431071954329372011, 4645235333920882311, 4711612782120584129, 4817795224349893863, 4817974248441994562, 4850038331891329531, 4894368402155856911, 4896369234689874399, 492319991885313353, 4955132635037596414, 4983818699378437228, 515162574920286072, 5251362904662243570, 5254301897775440390, 5602394546716194393, 5687506101791582912, 5706646432440054537, 579133731864854298, 5889350259465711581, 5990936112727757727, 6107327788068934928, 6148794050675945307, 6175083279252245571, 6259659445228937830, 6341509225780842810, 6355155816775235373, 6390099235948807872, 6512481728867966666, 6562699612202682951, 6650721219920470220, 6813277774531714268, 6832385380846153809, 6843682661340527365, 6854572782502496472, 6873643543873032607, 6943857669418767713, 7013831508991147618, 7398560778432584627, 7430728925621180997, 7529229670910969970, 7764025273645238291, 7765228544444959629, 7779672812961006890, 7922318899888010968, 7962562577358386996, 8058598779437778077, 8101892604684416046, 8103573610261927761, 8171406992532519676, 8350384134273338216, 8383752804592508951, 847354487404123150, 8701447029114309275, 8711943759834762682, 8715204045529667240, 875076957162738993, 87960314680273391, 881681722863119344, 8966960952503898650, 8975239696024649946, 899322692557351514, 905811033458631778, 9084575050258091193, 968363283004982583]
INFO 23:35:50,525 Enqueuing flush of Memtable-local@1880511428(84/840 serialized/live bytes, 4 ops)
INFO 23:35:50,526 Writing Memtable-local@1880511428(84/840 serialized/live bytes, 4 ops)
WARN 23:35:50,527 setting live ratio to maximum of 64.0 instead of Infinity
INFO 23:35:50,529 CFS(Keyspace=’system’, ColumnFamily=’local’) liveRatio is 64.0 (just-counted was 64.0). calculation took 2ms for 0 cells
INFO 23:35:50,579 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-8-Data.db (115 bytes) for commitlog position ReplayPosition(segmentId=1425270949016, position=173925)
INFO 23:35:50,587 Compacting [SSTableReader(path=’/var/lib/cassandra/data/system/local/system-local-jb-5-Data.db’), SSTableReader(path=’/var/lib/cassandra/data/system/local/system-local-jb-7-Data.db’), SSTableReader(path=’/var/lib/cassandra/data/system/local/system-local-jb-8-Data.db’), SSTableReader(path=’/var/lib/cassandra/data/system/local/system-local-jb-6-Data.db’)]
INFO 23:35:50,625 Enqueuing flush of Memtable-local@2046033358(10101/646464 serialized/live bytes, 259 ops)
INFO 23:35:50,625 Writing Memtable-local@2046033358(10101/646464 serialized/live bytes, 259 ops)
WARN 23:35:50,631 setting live ratio to maximum of 64.0 instead of Infinity
INFO 23:35:50,631 CFS(Keyspace=’system’, ColumnFamily=’local’) liveRatio is 64.0 (just-counted was 64.0). calculation took 0ms for 0 cells
INFO 23:35:50,708 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-9-Data.db (5230 bytes) for commitlog position ReplayPosition(segmentId=1425270949016, position=185927)
INFO 23:35:50,761 Node localhost/127.0.0.1 state jump to normal
INFO 23:35:50,798 Compacted 4 sstables to [/var/lib/cassandra/data/system/local/system-local-jb-10,]. 6,183 bytes to 5,647 (~91% of original) in 195ms = 0.027617MB/s. 4 total partitions merged to 1. Partition merge counts were {4:1, }
INFO 23:35:50,993 Starting listening for CQL clients on localhost/127.0.0.1:9042…
INFO 23:35:51,267 Using TFramedTransport with a max frame size of 15728640 bytes.
INFO 23:35:51,270 Binding thrift service to localhost/127.0.0.1:9160
INFO 23:35:51,326 Using synchronous/threadpool thrift server on localhost : 9160
INFO 23:35:51,327 Listening for thrift clients…

4.将安装好cassandra的docker镜像保存

4.1 获取到刚才操作的实例容器ID

docker ps -l
CONTAINER ID        IMAGE                    COMMAND                CREATED             STATUS              PORTS                                                                                                                                                                                                                                                                                                                                                              NAMES
f5a65aa8022f        sequenceiq/spark:1.2.0   "/etc/bootstrap.sh -   6 minutes ago       Up 6 minutes        0.0.0.0:49181->22/tcp, 0.0.0.0:49182->49707/tcp, 0.0.0.0:49183->50070/tcp, 0.0.0.0:49184->8032/tcp, 0.0.0.0:49185->8042/tcp, 0.0.0.0:49186->8088/tcp, 0.0.0.0:49187->50020/tcp, 0.0.0.0:49188->8031/tcp, 0.0.0.0:49189->8033/tcp, 0.0.0.0:49190->8040/tcp, 0.0.0.0:49191->50010/tcp, 0.0.0.0:49192->50075/tcp, 0.0.0.0:49193->50090/tcp, 0.0.0.0:49194->8030/tcp   berserk_fermi       

4.2保存docker镜像

可以看到当前操作的容器ID为:f5a65aa8022f。注意了,一旦进行所有操作,都需要提交保存

docker commit f5a65aa8022f sequenceiq/spark:1.2.0 
f1af881a3213ac322899d3ba9904fdff061f393579b5b1c8f41475ace92e8cdb

这样下次再启动就可以访问spark和cassandra了。

在已经安装好spark的docker镜像里安装cassandra2.0.7

标签:cassandra   docer   

原文地址:http://blog.csdn.net/myboyliu2007/article/details/44016967

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!