Overview
Like any other no enterprise/no commercial/no over-complicated database. Installation of Cassandra is done via YUM. The installation is pretty simple:
- Install Java JDK
- Configure Cassandra Repo
- Install Cassandra
Install JDK
JDK stands for Java Development KIt, it is usually used to create Java programs, in the JDK, you have the JRE which is used to run Java programs:
[root@localhost ~]# wget --no-cookies --no-check-certificate --header "Cookie:oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm" --2018-05-14 04:57:07-- http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm Resolving download.oracle.com (download.oracle.com)... 2.17.204.119 Connecting to download.oracle.com (download.oracle.com)|2.17.204.119|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm [following] --2018-05-14 04:57:07-- https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.33.75.164, 2a02:26f0:4:197::2d3e, 2a02:26f0:4:199::2d3e Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.33.75.164|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm?AuthParam=1526288348_ab6986e311e29cccdffc20f30e7d2d71 [following] --2018-05-14 04:57:08-- http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm?AuthParam=1526288348_ab6986e311e29cccdffc20f30e7d2d71 Connecting to download.oracle.com (download.oracle.com)|2.17.204.119|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 169983496 (162M) [application/x-redhat-package-manager] Saving to: ‘jdk-8u131-linux-x64.rpm’ 100%[===========================================================================================================================================================================>] 169,983,496 2.96MB/s in 54s 2018-05-14 04:58:03 (3.02 MB/s) - ‘jdk-8u131-linux-x64.rpm’ saved [169983496/169983496] [root@localhost ~]# yum -y localinstall jdk-8u131-linux-x64.rpm Loaded plugins: fastestmirror Examining jdk-8u131-linux-x64.rpm: 2000:jdk1.8.0_131-1.8.0_131-fcs.x86_64 Marking jdk-8u131-linux-x64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package jdk1.8.0_131.x86_64 2000:1.8.0_131-fcs will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================================== Installing: jdk1.8.0_131 x86_64 2000:1.8.0_131-fcs /jdk-8u131-linux-x64 269 M Transaction Summary ===================================================================================================================================================================================================================== Install 1 Package Total size: 269 M Installed size: 269 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 2000:jdk1.8.0_131-1.8.0_131-fcs.x86_64 1/1 Unpacking JAR files... tools.jar... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar... Verifying : 2000:jdk1.8.0_131-1.8.0_131-fcs.x86_64 1/1 Installed: jdk1.8.0_131.x86_64 2000:1.8.0_131-fcs Complete! [root@localhost ~]# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
After the JDK/JRE are installed we can install Cassandra:
Installing Cassandra
[root@localhost ~]# vi /etc/yum.repos.d/cassandra.repo [root@localhost ~]# yum -y install cassandra Loaded plugins: fastestmirror cassandra/signature | 819 B 00:00:00 Retrieving key from https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0xF2833C93: Userid : "Eric Evans <[email protected]>" Fingerprint: cec8 6bb4 a0ba 9d0f 9039 7cae f835 8fa2 f283 3c93 From : https://www.apache.org/dist/cassandra/KEYS cassandra/signature | 2.9 kB 00:00:00 !!! cassandra/primary_db | 8.0 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.coreix.net * extras: mirrors.coreix.net * updates: mirrors.coreix.net Resolving Dependencies --> Running transaction check ---> Package cassandra.noarch 0:3.11.2-1 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================================== Installing: cassandra noarch 3.11.2-1 cassandra 28 M Transaction Summary ===================================================================================================================================================================================================================== Install 1 Package Total download size: 28 M Installed size: 37 M Downloading packages: warning: /var/cache/yum/x86_64/7/cassandra/packages/cassandra-3.11.2-1.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID fe4b2bda: NOKEY======================================= ] 7.3 MB/s | 27 MB 00:00:00 ETA Public key for cassandra-3.11.2-1.noarch.rpm is not installed cassandra-3.11.2-1.noarch.rpm | 28 MB 00:00:03 Retrieving key from https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0xF2833C93: Userid : "Eric Evans <[email protected]>" Fingerprint: cec8 6bb4 a0ba 9d0f 9039 7cae f835 8fa2 f283 3c93 From : https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0x8D77295D: Userid : "Eric Evans <[email protected]>" Fingerprint: c496 5ee9 e301 5d19 2ccc f2b6 f758 ce31 8d77 295d From : https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0x2B5C1B00: Userid : "Sylvain Lebresne (pcmanus) <[email protected]>" Fingerprint: 5aed 1bf3 78e9 a19d ade1 bcb3 4bd7 36a8 2b5c 1b00 From : https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0x0353B12C: Userid : "T Jake Luciani <[email protected]>" Fingerprint: 514a 2ad6 31a5 7a16 dd00 47ec 749d 6eec 0353 b12c From : https://www.apache.org/dist/cassandra/KEYS Importing GPG key 0xFE4B2BDA: Userid : "Michael Shuler <[email protected]>" Fingerprint: a26e 528b 271f 19b9 e5d8 e19e a278 b781 fe4b 2bda From : https://www.apache.org/dist/cassandra/KEYS Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : cassandra-3.11.2-1.noarch 1/1 Verifying : cassandra-3.11.2-1.noarch 1/1 Installed: cassandra.noarch 0:3.11.2-1 Complete! [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl start cassandra [root@localhost ~]# systemctl enable cassandra cassandra.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig cassandra on [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.65 KiB 256 100.0% cd6bca3f-603d-4065-8d2e-136883606e4c rack1 [root@localhost ~]# cqlsh Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh> help Documented shell commands: =========================== CAPTURE CLS COPY DESCRIBE EXPAND LOGIN SERIAL SOURCE UNICODE CLEAR CONSISTENCY DESC EXIT HELP PAGING SHOW TRACING CQL help topics: ================ AGGREGATES CREATE_KEYSPACE DROP_TRIGGER TEXT ALTER_KEYSPACE CREATE_MATERIALIZED_VIEW DROP_TYPE TIME ALTER_MATERIALIZED_VIEW CREATE_ROLE DROP_USER TIMESTAMP ALTER_TABLE CREATE_TABLE FUNCTIONS TRUNCATE ALTER_TYPE CREATE_TRIGGER GRANT TYPES ALTER_USER CREATE_TYPE INSERT UPDATE APPLY CREATE_USER INSERT_JSON USE ASCII DATE INT UUID BATCH DELETE JSON BEGIN DROP_AGGREGATE KEYWORDS BLOB DROP_COLUMNFAMILY LIST_PERMISSIONS BOOLEAN DROP_FUNCTION LIST_ROLES COUNTER DROP_INDEX LIST_USERS CREATE_AGGREGATE DROP_KEYSPACE PERMISSIONS CREATE_COLUMNFAMILY DROP_MATERIALIZED_VIEW REVOKE CREATE_FUNCTION DROP_ROLE SELECT CREATE_INDEX DROP_TABLE SELECT_JSON