본문 바로가기

NoSQL/Cassandra

Cassandra version 3.7 install on AWS Ubuntu 16.04

설치환경

  • Instance Type : m4.xlarge
  • Storage : EBS 8G + EBS 300G
  • OS Version : ubuntu 16.04
  • Cassandra Version : Cassandra 3.7
  • JDK : Oracle JDK 1.8.0_101

카산드라 설치

카산드라를 설치하기 이전에 jdk가 설치되어 있어야 합니다. 그 이유는 cassandra가 JAVA 기반이기 때문입니다.

# 먼저 jdk가 설치되어 있는지 version을 먼저 확인합니다.
root@localhost:~# java -version
The program 'java' can be found in the following packages:
 * default-jre
 * gcj-5-jre-headless
 * openjdk-8-jre-headless
 * gcj-4.8-jre-headless
 * gcj-4.9-jre-headless
 * openjdk-9-jre-headless
Try: apt install <selected package>
 
# java를 받기위한 repository를 추가해줍니다.
root@localhost:~# add-apt-repository ppa:webupd8team/java
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.
...
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
 
# apt-get을 먼저 update 해준 후
root@localhost:~# sudo apt-get update
Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial InRelease
...
Get:36 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [1,176 B]
Fetched 10.7 MB in 3s (2,914 kB/s)
Reading package lists... Done
W: GPG error: http://dl.bintray.com/apache/cassandra 37x InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 749D6EEC0353B12C
W: The repository 'http://www.apache.org/dist/cassandra/debian 37x InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
 
# java 8을 설치해줍니다.
root@localhost:~# apt-get install oracle-java8-set-default
Reading package lists... Done
Building dependency tree
...
The following NEW packages will be installed:
  binutils gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 oracle-java8-installer oracle-java8-set-default x11-common xfonts-encodings xfonts-utils
0 upgraded, 11 newly installed, 0 to remove and 31 not upgraded.
Need to get 6,478 kB/6,508 kB of archives.
After this operation, 20.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 oracle-java8-installer all 8u101+8u101arm-1~webupd8~2 [23.6 kB]
Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libfontenc1 amd64 1:1.1.3-1 [13.9 kB]
...
Saving to: ‘jdk-8u101-linux-x64.tar.gz’
 
     0K ........ ........ ........ ........ ........ ........  1% 47.1M 4s
  3072K ........ ........ ........ ........ ........ ........  3% 45.1M 4s
....
175104K ........ ........ ........ .......                   100%  123M=4.8s
 
2016-09-23 01:28:37 (36.2 MB/s) - ‘jdk-8u101-linux-x64.tar.gz’ saved [181352138/181352138]
 
Download done.
Removing outdated cached downloads...
update-alternatives: error: no alternatives for java
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
 
Processing triggers for ureadahead (0.100.0-19) ...
 
# 설치가 완료된 이후 java의 버전을 확인합니다.
root@localhost:~# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

 

Cassandra를 설치하려면 설치파일의 위치를 알아야 합니다. 따라서 /etc/apt/sources.list에 추가를 해주셔야 합니다.

root@localhost:~# vi /etc/apt/sources.list
vi로 연 후 아래 두 줄을 맨 아래에 추가해 주시면됩니다. version은 최신버전인 3.7버전을 설치하였습니다.
deb http://www.apache.org/dist/cassandra/debian 37x main
deb-src http://www.apache.org/dist/cassandra/debian 37x main

cassandra page에 있는 gpg key를 입력해줍니다.

root@localhost:~# gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 0353B12C from hkp server pgp.mit.edu
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 0353B12C: public key "T Jake Luciani <jake@apache.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
 
root@localhost:~# gpg --export --armor 0353B12C | sudo apt-key add -
OK

이후 update 후 install을 시작합니다.

root@localhost:~# apt-get update
root@localhost:~# apt-get install cassandra
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libopts25 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib ntp python python-minimal python2.7 python2.7-minimal
Suggested packages:
  cassandra-tools ntp-doc python-doc python-tk python2.7-doc binfmt-support
The following NEW packages will be installed:
  cassandra libopts25 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib ntp python python-minimal python2.7 python2.7-minimal
0 upgraded, 10 newly installed, 0 to remove and 31 not upgraded.
Need to get 32.8 MB of archives.
After this operation, 56.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
 
Get:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libopts25 amd64 1:5.18.7-3 [57.8 kB]
...
Adding group `cassandra' (GID 117) ...
Done.
vm.max_map_count = 1048575
net.ipv4.tcp_keepalive_time = 300
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...

cassandra 설치후 서비스 및 node를 확인합니다.

root@localhost:~# service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/init.d/cassandra; bad; vendor preset: enabled)
   Active: active (running) since Fri 2016-09-23 01:32:34 UTC; 21s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/cassandra.service
           └─16695 java -Xloggc:/var/log/cassandra/gc.log -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+AlwaysPreTouch -XX:-UseBia
 
Sep 23 01:32:34 localhost systemd[1]: Starting LSB: distributed storage system for structured data...
Sep 23 01:32:34 localhost systemd[1]: Started LSB: distributed storage system for structured data.
 
root@localhost:~# nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  103.02 KiB  256          100.0%            575e0cf9-5487-4fcb-bc3f-49b956f72f87  rack1

 

참고사이트


'NoSQL > Cassandra' 카테고리의 다른 글

Requirements for Cassandra on AWS  (0) 2016.11.27
Key Components for Configuring Cassandra  (0) 2016.11.27
Apache Cassandra 란?  (0) 2016.11.27