Cassandra on Fedora 27
The last time that I installed Cassandra was on a version of Fedora 20. So, I new the first thing to check was the installation of Java. You can check the Java installation with two statements on a fresh installation of Fedora 27. You need to check the Java runtime and then the Java Software Development Kit before installing, starting, and using Cassandra.
Installing Prerequisites
You check the Java runtime with this command:
java -version |
It should return:
openjdk version "1.8.0_171" OpenJDK Runtime Environment (build 1.8.0_171-b10) OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode) |
You check the Java Software Development Kit (JSDK) with this command:
javac -version |
It should return:
javac 1.8.0_171 |
After verifying the Java and JSDK installation, you can install the Cassandra packages with the following yum
command as the root
user or a user with sudoer privileges:
yum install -y *cassandra* |
You should see a successful installation log like:
Display Cassandra Log File →
Last metadata expiration check: 2:01:07 ago on Wed 16 May 2018 09:48:04 PM MDT. Dependencies resolved. ================================================================================================ Package Arch Version Repository Size ================================================================================================ Installing: cassandra x86_64 3.11.1-4.fc27 updates 175 k cassandra-java-driver noarch 3.1.4-2.fc27 fedora 1.0 M cassandra-java-driver-extras noarch 3.1.4-2.fc27 fedora 60 k cassandra-java-driver-javadoc noarch 3.1.4-2.fc27 fedora 675 k cassandra-java-driver-mapping noarch 3.1.4-2.fc27 fedora 87 k cassandra-java-driver-parent noarch 3.1.4-2.fc27 fedora 15 k cassandra-java-driver-tests noarch 3.1.4-2.fc27 fedora 21 k cassandra-javadoc x86_64 3.11.1-4.fc27 updates 3.3 M cassandra-parent x86_64 3.11.1-4.fc27 updates 17 k cassandra-server x86_64 3.11.1-4.fc27 updates 179 k python-cassandra-driver-doc x86_64 3.13.0-1.fc27 updates 64 k python2-cassandra-driver x86_64 3.13.0-1.fc27 updates 2.6 M python3-cassandra-driver x86_64 3.13.0-1.fc27 updates 2.8 M Installing dependencies: airline noarch 0.7-6.fc27 fedora 89 k antlr3-java noarch 1:3.5.2-16.fc27 fedora 173 k apache-commons-configuration noarch 1.10-10.fc27 fedora 358 k avalon-framework noarch 4.3-18.fc27 fedora 89 k avalon-logkit noarch 2.1-28.fc27 fedora 85 k bean-validation-api noarch 1.1.0-8.fc27 fedora 61 k caffeine noarch 2.3.5-3.fc27 fedora 724 k cassandra-java-libs x86_64 3.11.1-4.fc27 updates 5.3 M cassandra-python2-cqlshlib x86_64 3.11.1-4.fc27 updates 631 k classmate noarch 1.3.1-3.fc27 fedora 72 k compress-lzf noarch 1.0.3-7.fc27 fedora 86 k concurrentlinkedhashmap-lru noarch 1.4.2-5.fc27 fedora 59 k dain-snappy noarch 0.4-4.fc27 fedora 67 k ecj noarch 1:4.7.1-1.fc27 fedora 2.2 M fastutil noarch 7.0.7-4.fc27 fedora 14 M felix-framework noarch 5.6.0-3.fc27 fedora 672 k findbugs noarch 3.0.1-11.fc27 fedora 4.5 M findbugs-bcel noarch 6.0-0.9.20140707svn1547656.fc27 fedora 572 k fontbox noarch 1.8.13-1.fc26 fedora 228 k fop noarch 2.0-7.fc27 fedora 4.5 M hibernate-validator noarch 5.2.4-3.fc27 fedora 632 k high-scale-lib noarch 1.1.4-9.fc27 fedora 105 k jBCrypt noarch 0.4-5.fc27 fedora 22 k jFormatString noarch 0-0.26.20131227gitf159b88.fc27 fedora 38 k jackson noarch 1.9.11-12.fc27 fedora 1.0 M jamm noarch 0.3.1-5.fc27 fedora 35 k jboss-logging noarch 3.3.0-3.fc27 fedora 73 k jcip-annotations noarch 1-21.20060626.fc27 fedora 13 k jna x86_64 4.4.0-7.fc27 fedora 237 k joda-time noarch 2.9.3-4.tzdata2016c.fc27 fedora 522 k jsr-311 noarch 1.1.1-14.fc27 fedora 50 k log4j-over-slf4j noarch 1.7.25-4.fc27 updates 36 k logback noarch 1.1.7-3.fc27 fedora 3.0 M lz4-java x86_64 1.3.0-8.fc27 fedora 151 k maven-archiver noarch 3.1.1-3.fc27 fedora 38 k maven-common-artifact-filters noarch 3.0.1-3.fc27 fedora 60 k maven-compiler-plugin noarch 3.6.1-3.fc27 fedora 67 k maven-doxia-core noarch 1.7-5.fc27 fedora 166 k maven-doxia-logging-api noarch 1.7-5.fc27 fedora 30 k maven-doxia-module-apt noarch 1.7-5.fc27 fedora 63 k maven-doxia-module-fml noarch 1.7-5.fc27 fedora 51 k maven-doxia-module-fo noarch 1.7-5.fc27 fedora 72 k maven-doxia-module-markdown noarch 1.7-5.fc27 fedora 29 k maven-doxia-module-xdoc noarch 1.7-5.fc27 fedora 50 k maven-doxia-module-xhtml noarch 1.7-5.fc27 fedora 31 k maven-doxia-sink-api noarch 1.7-5.fc27 fedora 25 k maven-doxia-sitetools noarch 1.7.4-4.fc27 fedora 186 k maven-failsafe-plugin noarch 2.19.1-8.fc27 fedora 65 k maven-javadoc-plugin noarch 2.10.4-4.fc27 fedora 222 k maven-plugin-annotations noarch 3.5-3.fc27 fedora 26 k maven-reporting-api noarch 1:3.0-12.fc27 fedora 23 k maven-shared-incremental noarch 1.1-13.fc27 fedora 26 k maven-surefire noarch 2.19.1-8.fc27 fedora 496 k maven-surefire-plugin noarch 2.19.1-8.fc27 fedora 40 k metrics noarch 3.1.2-5.fc27 fedora 109 k metrics-jvm noarch 3.1.2-5.fc27 fedora 45 k metrics-reporter-config noarch 3.2.2-2.fc27 fedora 57 k objectweb-asm3 noarch 3.3.1-15.fc27 fedora 397 k ohc noarch 0.6.1-1.fc27 fedora 147 k parboiled noarch 1.1.6-12.fc27 fedora 281 k pegdown noarch 1.4.2-11.fc27 fedora 85 k plexus-archiver noarch 3.4-3.fc27 fedora 179 k plexus-compiler noarch 2.8.1-5.fc27 fedora 69 k plexus-component-api noarch 1.0-0.23.alpha15.fc27 fedora 31 k plexus-i18n noarch 1.0-0.10.b10.4.fc27 fedora 23 k plexus-interactivity-api noarch 1.0-0.24.alpha6.fc27 fedora 19 k plexus-io noarch 2.7.1-3.fc27 fedora 88 k python-blist x86_64 1.3.6-12.fc27 fedora 66 k python-scales noarch 1.0.5-10.fc27 fedora 68 k python2-futures noarch 3.1.1-2.fc27 fedora 32 k python2-simplejson x86_64 3.10.0-5.fc27 fedora 278 k python3-blist x86_64 1.3.6-12.fc27 fedora 66 k python3-scales noarch 1.0.5-10.fc27 fedora 70 k python3-simplejson x86_64 3.10.0-5.fc27 fedora 278 k sigar x86_64 1.6.5-0.20.git58097d9.fc27 fedora 76 k sigar-java x86_64 1.6.5-0.20.git58097d9.fc27 fedora 391 k snappy-java x86_64 1.1.2.4-8.fc27 fedora 80 k sonatype-oss-parent noarch 7-13.fc27 fedora 15 k stream-lib noarch 2.6.0-8.fc27 fedora 161 k xmlunit noarch 1.6-6.fc27 fedora 365 k Transaction Summary ================================================================================================ Install 93 Packages Total download size: 56 M Installed size: 172 M Downloading Packages: (1/93): cassandra-java-driver-extras-3.1.4-2.fc27.noarch.rpm 199 kB/s | 60 kB 00:00 (2/93): cassandra-java-driver-mapping-3.1.4-2.fc27.noarch.rpm 531 kB/s | 87 kB 00:00 (3/93): cassandra-java-driver-parent-3.1.4-2.fc27.noarch.rpm 308 kB/s | 15 kB 00:00 (4/93): cassandra-java-driver-tests-3.1.4-2.fc27.noarch.rpm 397 kB/s | 21 kB 00:00 (5/93): metrics-3.1.2-5.fc27.noarch.rpm 1.1 MB/s | 109 kB 00:00 (6/93): cassandra-java-driver-javadoc-3.1.4-2.fc27.noarch.rpm 864 kB/s | 675 kB 00:00 (7/93): cassandra-java-driver-3.1.4-2.fc27.noarch.rpm 1.2 MB/s | 1.0 MB 00:00 (8/93): maven-failsafe-plugin-2.19.1-8.fc27.noarch.rpm 957 kB/s | 65 kB 00:00 (9/93): maven-compiler-plugin-3.6.1-3.fc27.noarch.rpm 369 kB/s | 67 kB 00:00 (10/93): sonatype-oss-parent-7-13.fc27.noarch.rpm 170 kB/s | 15 kB 00:00 (11/93): maven-surefire-plugin-2.19.1-8.fc27.noarch.rpm 309 kB/s | 40 kB 00:00 (12/93): maven-javadoc-plugin-2.10.4-4.fc27.noarch.rpm 1.0 MB/s | 222 kB 00:00 (13/93): maven-shared-incremental-1.1-13.fc27.noarch.rpm 236 kB/s | 26 kB 00:00 (14/93): plexus-compiler-2.8.1-5.fc27.noarch.rpm 760 kB/s | 69 kB 00:00 (15/93): maven-plugin-annotations-3.5-3.fc27.noarch.rpm 287 kB/s | 26 kB 00:00 (16/93): maven-archiver-3.1.1-3.fc27.noarch.rpm 662 kB/s | 38 kB 00:00 (17/93): felix-framework-5.6.0-3.fc27.noarch.rpm 1.8 MB/s | 672 kB 00:00 (18/93): maven-common-artifact-filters-3.0.1-3.fc27.noarch.rpm 656 kB/s | 60 kB 00:00 (19/93): maven-doxia-sink-api-1.7-5.fc27.noarch.rpm 296 kB/s | 25 kB 00:00 (20/93): maven-surefire-2.19.1-8.fc27.noarch.rpm 2.0 MB/s | 496 kB 00:00 (21/93): maven-reporting-api-3.0-12.fc27.noarch.rpm 363 kB/s | 23 kB 00:00 (22/93): maven-doxia-sitetools-1.7.4-4.fc27.noarch.rpm 1.1 MB/s | 186 kB 00:00 (23/93): plexus-archiver-3.4-3.fc27.noarch.rpm 1.2 MB/s | 179 kB 00:00 (24/93): plexus-interactivity-api-1.0-0.24.alpha6.fc27.noarch.r 163 kB/s | 19 kB 00:00 (25/93): maven-doxia-logging-api-1.7-5.fc27.noarch.rpm 273 kB/s | 30 kB 00:00 (26/93): maven-doxia-core-1.7-5.fc27.noarch.rpm 1.8 MB/s | 166 kB 00:00 (27/93): maven-doxia-module-apt-1.7-5.fc27.noarch.rpm 623 kB/s | 63 kB 00:00 (28/93): maven-doxia-module-fml-1.7-5.fc27.noarch.rpm 742 kB/s | 51 kB 00:00 (29/93): maven-doxia-module-fo-1.7-5.fc27.noarch.rpm 770 kB/s | 72 kB 00:00 (30/93): maven-doxia-module-markdown-1.7-5.fc27.noarch.rpm 341 kB/s | 29 kB 00:00 (31/93): maven-doxia-module-xdoc-1.7-5.fc27.noarch.rpm 469 kB/s | 50 kB 00:00 (32/93): maven-doxia-module-xhtml-1.7-5.fc27.noarch.rpm 290 kB/s | 31 kB 00:00 (33/93): plexus-i18n-1.0-0.10.b10.4.fc27.noarch.rpm 161 kB/s | 23 kB 00:00 (34/93): plexus-io-2.7.1-3.fc27.noarch.rpm 899 kB/s | 88 kB 00:00 (35/93): dain-snappy-0.4-4.fc27.noarch.rpm 445 kB/s | 67 kB 00:00 (36/93): plexus-component-api-1.0-0.23.alpha15.fc27.noarch.rpm 322 kB/s | 31 kB 00:00 (37/93): apache-commons-configuration-1.10-10.fc27.noarch.rpm 1.9 MB/s | 358 kB 00:00 (38/93): xmlunit-1.6-6.fc27.noarch.rpm 1.6 MB/s | 365 kB 00:00 (39/93): pegdown-1.4.2-11.fc27.noarch.rpm 1.2 MB/s | 85 kB 00:00 (40/93): avalon-framework-4.3-18.fc27.noarch.rpm 770 kB/s | 89 kB 00:00 (41/93): fontbox-1.8.13-1.fc26.noarch.rpm 1.2 MB/s | 228 kB 00:00 (42/93): parboiled-1.1.6-12.fc27.noarch.rpm 1.6 MB/s | 281 kB 00:00 (43/93): avalon-logkit-2.1-28.fc27.noarch.rpm 1.2 MB/s | 85 kB 00:00 (44/93): fop-2.0-7.fc27.noarch.rpm 4.8 MB/s | 4.5 MB 00:00 (45/93): cassandra-3.11.1-4.fc27.x86_64.rpm 290 kB/s | 175 kB 00:00 (46/93): airline-0.7-6.fc27.noarch.rpm 917 kB/s | 89 kB 00:00 (47/93): antlr3-java-3.5.2-16.fc27.noarch.rpm 1.4 MB/s | 173 kB 00:00 (48/93): caffeine-2.3.5-3.fc27.noarch.rpm 5.6 MB/s | 724 kB 00:00 (49/93): compress-lzf-1.0.3-7.fc27.noarch.rpm 899 kB/s | 86 kB 00:00 (50/93): concurrentlinkedhashmap-lru-1.4.2-5.fc27.noarch.rpm 734 kB/s | 59 kB 00:00 (51/93): cassandra-java-libs-3.11.1-4.fc27.x86_64.rpm 4.2 MB/s | 5.3 MB 00:01 (52/93): cassandra-python2-cqlshlib-3.11.1-4.fc27.x86_64.rpm 708 kB/s | 631 kB 00:00 (53/93): ecj-4.7.1-1.fc27.noarch.rpm 6.8 MB/s | 2.2 MB 00:00 (54/93): jBCrypt-0.4-5.fc27.noarch.rpm 306 kB/s | 22 kB 00:00 (55/93): high-scale-lib-1.1.4-9.fc27.noarch.rpm 437 kB/s | 105 kB 00:00 (56/93): jamm-0.3.1-5.fc27.noarch.rpm 586 kB/s | 35 kB 00:00 (57/93): jackson-1.9.11-12.fc27.noarch.rpm 7.9 MB/s | 1.0 MB 00:00 (58/93): joda-time-2.9.3-4.tzdata2016c.fc27.noarch.rpm 3.6 MB/s | 522 kB 00:00 (59/93): lz4-java-1.3.0-8.fc27.x86_64.rpm 2.1 MB/s | 151 kB 00:00 (60/93): metrics-jvm-3.1.2-5.fc27.noarch.rpm 742 kB/s | 45 kB 00:00 (61/93): logback-1.1.7-3.fc27.noarch.rpm 10 MB/s | 3.0 MB 00:00 (62/93): metrics-reporter-config-3.2.2-2.fc27.noarch.rpm 512 kB/s | 57 kB 00:00 (63/93): ohc-0.6.1-1.fc27.noarch.rpm 1.4 MB/s | 147 kB 00:00 (64/93): snappy-java-1.1.2.4-8.fc27.x86_64.rpm 1.2 MB/s | 80 kB 00:00 (65/93): sigar-java-1.6.5-0.20.git58097d9.fc27.x86_64.rpm 3.1 MB/s | 391 kB 00:00 (66/93): stream-lib-2.6.0-8.fc27.noarch.rpm 1.8 MB/s | 161 kB 00:00 (67/93): jsr-311-1.1.1-14.fc27.noarch.rpm 815 kB/s | 50 kB 00:00 (68/93): objectweb-asm3-3.3.1-15.fc27.noarch.rpm 5.3 MB/s | 397 kB 00:00 (69/93): jna-4.4.0-7.fc27.x86_64.rpm 306 kB/s | 237 kB 00:00 (70/93): hibernate-validator-5.2.4-3.fc27.noarch.rpm 6.3 MB/s | 632 kB 00:00 (71/93): findbugs-bcel-6.0-0.9.20140707svn1547656.fc27.noarch.r 7.3 MB/s | 572 kB 00:00 (72/93): jFormatString-0-0.26.20131227gitf159b88.fc27.noarch.rp 805 kB/s | 38 kB 00:00 (73/93): jcip-annotations-1-21.20060626.fc27.noarch.rpm 277 kB/s | 13 kB 00:00 (74/93): findbugs-3.0.1-11.fc27.noarch.rpm 6.7 MB/s | 4.5 MB 00:00 (75/93): bean-validation-api-1.1.0-8.fc27.noarch.rpm 1.2 MB/s | 61 kB 00:00 (76/93): cassandra-server-3.11.1-4.fc27.x86_64.rpm 728 kB/s | 179 kB 00:00 (77/93): classmate-1.3.1-3.fc27.noarch.rpm 1.4 MB/s | 72 kB 00:00 (78/93): jboss-logging-3.3.0-3.fc27.noarch.rpm 1.3 MB/s | 73 kB 00:00 (79/93): sigar-1.6.5-0.20.git58097d9.fc27.x86_64.rpm 1.5 MB/s | 76 kB 00:00 (80/93): cassandra-parent-3.11.1-4.fc27.x86_64.rpm 130 kB/s | 17 kB 00:00 (81/93): python-cassandra-driver-doc-3.13.0-1.fc27.x86_64.rpm 245 kB/s | 64 kB 00:00 (82/93): python2-cassandra-driver-3.13.0-1.fc27.x86_64.rpm 3.3 MB/s | 2.6 MB 00:00 (83/93): python-blist-1.3.6-12.fc27.x86_64.rpm 306 kB/s | 66 kB 00:00 (84/93): cassandra-javadoc-3.11.1-4.fc27.x86_64.rpm 2.1 MB/s | 3.3 MB 00:01 (85/93): python-scales-1.0.5-10.fc27.noarch.rpm 183 kB/s | 68 kB 00:00 (86/93): python2-futures-3.1.1-2.fc27.noarch.rpm 89 kB/s | 32 kB 00:00 (87/93): python2-simplejson-3.10.0-5.fc27.x86_64.rpm 742 kB/s | 278 kB 00:00 (88/93): python3-blist-1.3.6-12.fc27.x86_64.rpm 705 kB/s | 66 kB 00:00 (89/93): python3-scales-1.0.5-10.fc27.noarch.rpm 707 kB/s | 70 kB 00:00 (90/93): python3-simplejson-3.10.0-5.fc27.x86_64.rpm 1.4 MB/s | 278 kB 00:00 (91/93): log4j-over-slf4j-1.7.25-4.fc27.noarch.rpm 148 kB/s | 36 kB 00:00 (92/93): python3-cassandra-driver-3.13.0-1.fc27.x86_64.rpm 2.4 MB/s | 2.8 MB 00:01 (93/93): fastutil-7.0.7-4.fc27.noarch.rpm 2.2 MB/s | 14 MB 00:06 ------------------------------------------------------------------------------------------------ Total 4.4 MB/s | 56 MB 00:12 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : maven-doxia-logging-api-1.7-5.fc27.noarch 1/93 Installing : maven-doxia-sink-api-1.7-5.fc27.noarch 2/93 Installing : metrics-3.1.2-5.fc27.noarch 3/93 Installing : cassandra-java-driver-3.1.4-2.fc27.noarch 4/93 Installing : maven-plugin-annotations-3.5-3.fc27.noarch 5/93 Installing : metrics-jvm-3.1.2-5.fc27.noarch 6/93 Installing : maven-reporting-api-1:3.0-12.fc27.noarch 7/93 Installing : joda-time-2.9.3-4.tzdata2016c.fc27.noarch 8/93 Installing : jna-4.4.0-7.fc27.x86_64 9/93 Installing : maven-common-artifact-filters-3.0.1-3.fc27.noarch 10/93 Installing : maven-surefire-2.19.1-8.fc27.noarch 11/93 Installing : maven-failsafe-plugin-2.19.1-8.fc27.noarch 12/93 Installing : maven-surefire-plugin-2.19.1-8.fc27.noarch 13/93 Installing : ohc-0.6.1-1.fc27.noarch 14/93 Installing : cassandra-java-driver-extras-3.1.4-2.fc27.noarch 15/93 Installing : cassandra-java-driver-mapping-3.1.4-2.fc27.noarch 16/93 Installing : log4j-over-slf4j-1.7.25-4.fc27.noarch 17/93 Installing : python3-simplejson-3.10.0-5.fc27.x86_64 18/93 Installing : python3-scales-1.0.5-10.fc27.noarch 19/93 Installing : python3-blist-1.3.6-12.fc27.x86_64 20/93 Installing : python2-simplejson-3.10.0-5.fc27.x86_64 21/93 Installing : python-scales-1.0.5-10.fc27.noarch 22/93 Installing : python2-futures-3.1.1-2.fc27.noarch 23/93 Installing : python-blist-1.3.6-12.fc27.x86_64 24/93 Installing : python2-cassandra-driver-3.13.0-1.fc27.x86_64 25/93 Installing : cassandra-python2-cqlshlib-3.11.1-4.fc27.x86_64 26/93 Installing : sigar-1.6.5-0.20.git58097d9.fc27.x86_64 27/93 Running scriptlet: sigar-1.6.5-0.20.git58097d9.fc27.x86_64 27/93 Installing : jboss-logging-3.3.0-3.fc27.noarch 28/93 Installing : classmate-1.3.1-3.fc27.noarch 29/93 Installing : bean-validation-api-1.1.0-8.fc27.noarch 30/93 Installing : hibernate-validator-5.2.4-3.fc27.noarch 31/93 Installing : metrics-reporter-config-3.2.2-2.fc27.noarch 32/93 Installing : jcip-annotations-1-21.20060626.fc27.noarch 33/93 Installing : jFormatString-0-0.26.20131227gitf159b88.fc27.noarch 34/93 Installing : findbugs-bcel-6.0-0.9.20140707svn1547656.fc27.noarch 35/93 Installing : findbugs-3.0.1-11.fc27.noarch 36/93 Installing : airline-0.7-6.fc27.noarch 37/93 Installing : fastutil-7.0.7-4.fc27.noarch 38/93 Installing : stream-lib-2.6.0-8.fc27.noarch 39/93 Installing : objectweb-asm3-3.3.1-15.fc27.noarch 40/93 Installing : jsr-311-1.1.1-14.fc27.noarch 41/93 Installing : jackson-1.9.11-12.fc27.noarch 42/93 Installing : snappy-java-1.1.2.4-8.fc27.x86_64 43/93 Installing : sigar-java-1.6.5-0.20.git58097d9.fc27.x86_64 44/93 Installing : lz4-java-1.3.0-8.fc27.x86_64 45/93 Installing : logback-1.1.7-3.fc27.noarch 46/93 Installing : jamm-0.3.1-5.fc27.noarch 47/93 Installing : jBCrypt-0.4-5.fc27.noarch 48/93 Installing : high-scale-lib-1.1.4-9.fc27.noarch 49/93 Installing : ecj-1:4.7.1-1.fc27.noarch 50/93 Installing : concurrentlinkedhashmap-lru-1.4.2-5.fc27.noarch 51/93 Installing : compress-lzf-1.0.3-7.fc27.noarch 52/93 Installing : caffeine-2.3.5-3.fc27.noarch 53/93 Installing : antlr3-java-1:3.5.2-16.fc27.noarch 54/93 Installing : cassandra-java-libs-3.11.1-4.fc27.x86_64 55/93 Installing : avalon-logkit-2.1-28.fc27.noarch 56/93 Installing : avalon-framework-4.3-18.fc27.noarch 57/93 Installing : parboiled-1.1.6-12.fc27.noarch 58/93 Installing : pegdown-1.4.2-11.fc27.noarch 59/93 Installing : fontbox-1.8.13-1.fc26.noarch 60/93 Installing : fop-2.0-7.fc27.noarch 61/93 Installing : apache-commons-configuration-1.10-10.fc27.noarch 62/93 Installing : xmlunit-1.6-6.fc27.noarch 63/93 Installing : maven-doxia-core-1.7-5.fc27.noarch 64/93 Installing : maven-doxia-module-xhtml-1.7-5.fc27.noarch 65/93 Installing : maven-doxia-module-markdown-1.7-5.fc27.noarch 66/93 Installing : maven-doxia-module-apt-1.7-5.fc27.noarch 67/93 Installing : maven-doxia-module-fml-1.7-5.fc27.noarch 68/93 Installing : maven-doxia-module-fo-1.7-5.fc27.noarch 69/93 Installing : maven-doxia-module-xdoc-1.7-5.fc27.noarch 70/93 Installing : plexus-component-api-1.0-0.23.alpha15.fc27.noarch 71/93 Installing : plexus-interactivity-api-1.0-0.24.alpha6.fc27.noarch 72/93 Installing : plexus-io-2.7.1-3.fc27.noarch 73/93 Installing : dain-snappy-0.4-4.fc27.noarch 74/93 Installing : plexus-archiver-3.4-3.fc27.noarch 75/93 Installing : maven-archiver-3.1.1-3.fc27.noarch 76/93 Installing : plexus-i18n-1.0-0.10.b10.4.fc27.noarch 77/93 Installing : maven-doxia-sitetools-1.7.4-4.fc27.noarch 78/93 Installing : maven-javadoc-plugin-2.10.4-4.fc27.noarch 79/93 Installing : plexus-compiler-2.8.1-5.fc27.noarch 80/93 Installing : maven-shared-incremental-1.1-13.fc27.noarch 81/93 Installing : maven-compiler-plugin-3.6.1-3.fc27.noarch 82/93 Installing : felix-framework-5.6.0-3.fc27.noarch 83/93 Installing : sonatype-oss-parent-7-13.fc27.noarch 84/93 Installing : cassandra-java-driver-parent-3.1.4-2.fc27.noarch 85/93 Installing : cassandra-java-driver-tests-3.1.4-2.fc27.noarch 86/93 Installing : cassandra-3.11.1-4.fc27.x86_64 87/93 warning: user cassandra does not exist - using root warning: group cassandra does not exist - using root Running scriptlet: cassandra-server-3.11.1-4.fc27.x86_64 88/93 /var/tmp/rpm-tmp.CAL3sJ: line 3: getrnt: command not found Installing : cassandra-server-3.11.1-4.fc27.x86_64 88/93 Running scriptlet: cassandra-server-3.11.1-4.fc27.x86_64 88/93 Installing : python3-cassandra-driver-3.13.0-1.fc27.x86_64 89/93 Installing : python-cassandra-driver-doc-3.13.0-1.fc27.x86_64 90/93 Installing : cassandra-parent-3.11.1-4.fc27.x86_64 91/93 Installing : cassandra-javadoc-3.11.1-4.fc27.x86_64 92/93 Installing : cassandra-java-driver-javadoc-3.1.4-2.fc27.noarch 93/93 Running scriptlet: cassandra-java-driver-javadoc-3.1.4-2.fc27.noarch 93/93 Running as unit: run-rfbf2f7cbd32a4b7c9ec02dd10f9c5c87.service Verifying : cassandra-java-driver-3.1.4-2.fc27.noarch 1/93 Verifying : cassandra-java-driver-extras-3.1.4-2.fc27.noarch 2/93 Verifying : cassandra-java-driver-javadoc-3.1.4-2.fc27.noarch 3/93 Verifying : cassandra-java-driver-mapping-3.1.4-2.fc27.noarch 4/93 Verifying : cassandra-java-driver-parent-3.1.4-2.fc27.noarch 5/93 Verifying : cassandra-java-driver-tests-3.1.4-2.fc27.noarch 6/93 Verifying : metrics-3.1.2-5.fc27.noarch 7/93 Verifying : maven-compiler-plugin-3.6.1-3.fc27.noarch 8/93 Verifying : maven-failsafe-plugin-2.19.1-8.fc27.noarch 9/93 Verifying : maven-javadoc-plugin-2.10.4-4.fc27.noarch 10/93 Verifying : maven-surefire-plugin-2.19.1-8.fc27.noarch 11/93 Verifying : sonatype-oss-parent-7-13.fc27.noarch 12/93 Verifying : felix-framework-5.6.0-3.fc27.noarch 13/93 Verifying : maven-shared-incremental-1.1-13.fc27.noarch 14/93 Verifying : plexus-compiler-2.8.1-5.fc27.noarch 15/93 Verifying : maven-plugin-annotations-3.5-3.fc27.noarch 16/93 Verifying : maven-surefire-2.19.1-8.fc27.noarch 17/93 Verifying : maven-archiver-3.1.1-3.fc27.noarch 18/93 Verifying : maven-common-artifact-filters-3.0.1-3.fc27.noarch 19/93 Verifying : maven-doxia-sink-api-1.7-5.fc27.noarch 20/93 Verifying : maven-doxia-sitetools-1.7.4-4.fc27.noarch 21/93 Verifying : maven-reporting-api-1:3.0-12.fc27.noarch 22/93 Verifying : plexus-archiver-3.4-3.fc27.noarch 23/93 Verifying : plexus-interactivity-api-1.0-0.24.alpha6.fc27.noarch 24/93 Verifying : maven-doxia-logging-api-1.7-5.fc27.noarch 25/93 Verifying : maven-doxia-core-1.7-5.fc27.noarch 26/93 Verifying : maven-doxia-module-apt-1.7-5.fc27.noarch 27/93 Verifying : maven-doxia-module-fml-1.7-5.fc27.noarch 28/93 Verifying : maven-doxia-module-fo-1.7-5.fc27.noarch 29/93 Verifying : maven-doxia-module-markdown-1.7-5.fc27.noarch 30/93 Verifying : maven-doxia-module-xdoc-1.7-5.fc27.noarch 31/93 Verifying : maven-doxia-module-xhtml-1.7-5.fc27.noarch 32/93 Verifying : plexus-i18n-1.0-0.10.b10.4.fc27.noarch 33/93 Verifying : dain-snappy-0.4-4.fc27.noarch 34/93 Verifying : plexus-io-2.7.1-3.fc27.noarch 35/93 Verifying : plexus-component-api-1.0-0.23.alpha15.fc27.noarch 36/93 Verifying : xmlunit-1.6-6.fc27.noarch 37/93 Verifying : apache-commons-configuration-1.10-10.fc27.noarch 38/93 Verifying : fop-2.0-7.fc27.noarch 39/93 Verifying : pegdown-1.4.2-11.fc27.noarch 40/93 Verifying : avalon-framework-4.3-18.fc27.noarch 41/93 Verifying : fontbox-1.8.13-1.fc26.noarch 42/93 Verifying : parboiled-1.1.6-12.fc27.noarch 43/93 Verifying : avalon-logkit-2.1-28.fc27.noarch 44/93 Verifying : cassandra-3.11.1-4.fc27.x86_64 45/93 Verifying : cassandra-java-libs-3.11.1-4.fc27.x86_64 46/93 Verifying : cassandra-python2-cqlshlib-3.11.1-4.fc27.x86_64 47/93 Verifying : airline-0.7-6.fc27.noarch 48/93 Verifying : antlr3-java-1:3.5.2-16.fc27.noarch 49/93 Verifying : caffeine-2.3.5-3.fc27.noarch 50/93 Verifying : compress-lzf-1.0.3-7.fc27.noarch 51/93 Verifying : concurrentlinkedhashmap-lru-1.4.2-5.fc27.noarch 52/93 Verifying : ecj-1:4.7.1-1.fc27.noarch 53/93 Verifying : high-scale-lib-1.1.4-9.fc27.noarch 54/93 Verifying : jBCrypt-0.4-5.fc27.noarch 55/93 Verifying : jackson-1.9.11-12.fc27.noarch 56/93 Verifying : jamm-0.3.1-5.fc27.noarch 57/93 Verifying : jna-4.4.0-7.fc27.x86_64 58/93 Verifying : joda-time-2.9.3-4.tzdata2016c.fc27.noarch 59/93 Verifying : logback-1.1.7-3.fc27.noarch 60/93 Verifying : lz4-java-1.3.0-8.fc27.x86_64 61/93 Verifying : metrics-jvm-3.1.2-5.fc27.noarch 62/93 Verifying : metrics-reporter-config-3.2.2-2.fc27.noarch 63/93 Verifying : ohc-0.6.1-1.fc27.noarch 64/93 Verifying : sigar-java-1.6.5-0.20.git58097d9.fc27.x86_64 65/93 Verifying : snappy-java-1.1.2.4-8.fc27.x86_64 66/93 Verifying : stream-lib-2.6.0-8.fc27.noarch 67/93 Verifying : findbugs-3.0.1-11.fc27.noarch 68/93 Verifying : jsr-311-1.1.1-14.fc27.noarch 69/93 Verifying : objectweb-asm3-3.3.1-15.fc27.noarch 70/93 Verifying : hibernate-validator-5.2.4-3.fc27.noarch 71/93 Verifying : fastutil-7.0.7-4.fc27.noarch 72/93 Verifying : findbugs-bcel-6.0-0.9.20140707svn1547656.fc27.noarch 73/93 Verifying : jFormatString-0-0.26.20131227gitf159b88.fc27.noarch 74/93 Verifying : jcip-annotations-1-21.20060626.fc27.noarch 75/93 Verifying : cassandra-server-3.11.1-4.fc27.x86_64 76/93 Verifying : bean-validation-api-1.1.0-8.fc27.noarch 77/93 Verifying : classmate-1.3.1-3.fc27.noarch 78/93 Verifying : jboss-logging-3.3.0-3.fc27.noarch 79/93 Verifying : sigar-1.6.5-0.20.git58097d9.fc27.x86_64 80/93 Verifying : cassandra-javadoc-3.11.1-4.fc27.x86_64 81/93 Verifying : cassandra-parent-3.11.1-4.fc27.x86_64 82/93 Verifying : python-cassandra-driver-doc-3.13.0-1.fc27.x86_64 83/93 Verifying : python2-cassandra-driver-3.13.0-1.fc27.x86_64 84/93 Verifying : python-blist-1.3.6-12.fc27.x86_64 85/93 Verifying : python-scales-1.0.5-10.fc27.noarch 86/93 Verifying : python2-futures-3.1.1-2.fc27.noarch 87/93 Verifying : python2-simplejson-3.10.0-5.fc27.x86_64 88/93 Verifying : python3-cassandra-driver-3.13.0-1.fc27.x86_64 89/93 Verifying : python3-blist-1.3.6-12.fc27.x86_64 90/93 Verifying : python3-scales-1.0.5-10.fc27.noarch 91/93 Verifying : python3-simplejson-3.10.0-5.fc27.x86_64 92/93 Verifying : log4j-over-slf4j-1.7.25-4.fc27.noarch 93/93 Installed: cassandra.x86_64 3.11.1-4.fc27 cassandra-java-driver.noarch 3.1.4-2.fc27 cassandra-java-driver-extras.noarch 3.1.4-2.fc27 cassandra-java-driver-javadoc.noarch 3.1.4-2.fc27 cassandra-java-driver-mapping.noarch 3.1.4-2.fc27 cassandra-java-driver-parent.noarch 3.1.4-2.fc27 cassandra-java-driver-tests.noarch 3.1.4-2.fc27 cassandra-javadoc.x86_64 3.11.1-4.fc27 cassandra-parent.x86_64 3.11.1-4.fc27 cassandra-server.x86_64 3.11.1-4.fc27 python-cassandra-driver-doc.x86_64 3.13.0-1.fc27 python2-cassandra-driver.x86_64 3.13.0-1.fc27 python3-cassandra-driver.x86_64 3.13.0-1.fc27 airline.noarch 0.7-6.fc27 antlr3-java.noarch 1:3.5.2-16.fc27 apache-commons-configuration.noarch 1.10-10.fc27 avalon-framework.noarch 4.3-18.fc27 avalon-logkit.noarch 2.1-28.fc27 bean-validation-api.noarch 1.1.0-8.fc27 caffeine.noarch 2.3.5-3.fc27 cassandra-java-libs.x86_64 3.11.1-4.fc27 cassandra-python2-cqlshlib.x86_64 3.11.1-4.fc27 classmate.noarch 1.3.1-3.fc27 compress-lzf.noarch 1.0.3-7.fc27 concurrentlinkedhashmap-lru.noarch 1.4.2-5.fc27 dain-snappy.noarch 0.4-4.fc27 ecj.noarch 1:4.7.1-1.fc27 fastutil.noarch 7.0.7-4.fc27 felix-framework.noarch 5.6.0-3.fc27 findbugs.noarch 3.0.1-11.fc27 findbugs-bcel.noarch 6.0-0.9.20140707svn1547656.fc27 fontbox.noarch 1.8.13-1.fc26 fop.noarch 2.0-7.fc27 hibernate-validator.noarch 5.2.4-3.fc27 high-scale-lib.noarch 1.1.4-9.fc27 jBCrypt.noarch 0.4-5.fc27 jFormatString.noarch 0-0.26.20131227gitf159b88.fc27 jackson.noarch 1.9.11-12.fc27 jamm.noarch 0.3.1-5.fc27 jboss-logging.noarch 3.3.0-3.fc27 jcip-annotations.noarch 1-21.20060626.fc27 jna.x86_64 4.4.0-7.fc27 joda-time.noarch 2.9.3-4.tzdata2016c.fc27 jsr-311.noarch 1.1.1-14.fc27 log4j-over-slf4j.noarch 1.7.25-4.fc27 logback.noarch 1.1.7-3.fc27 lz4-java.x86_64 1.3.0-8.fc27 maven-archiver.noarch 3.1.1-3.fc27 maven-common-artifact-filters.noarch 3.0.1-3.fc27 maven-compiler-plugin.noarch 3.6.1-3.fc27 maven-doxia-core.noarch 1.7-5.fc27 maven-doxia-logging-api.noarch 1.7-5.fc27 maven-doxia-module-apt.noarch 1.7-5.fc27 maven-doxia-module-fml.noarch 1.7-5.fc27 maven-doxia-module-fo.noarch 1.7-5.fc27 maven-doxia-module-markdown.noarch 1.7-5.fc27 maven-doxia-module-xdoc.noarch 1.7-5.fc27 maven-doxia-module-xhtml.noarch 1.7-5.fc27 maven-doxia-sink-api.noarch 1.7-5.fc27 maven-doxia-sitetools.noarch 1.7.4-4.fc27 maven-failsafe-plugin.noarch 2.19.1-8.fc27 maven-javadoc-plugin.noarch 2.10.4-4.fc27 maven-plugin-annotations.noarch 3.5-3.fc27 maven-reporting-api.noarch 1:3.0-12.fc27 maven-shared-incremental.noarch 1.1-13.fc27 maven-surefire.noarch 2.19.1-8.fc27 maven-surefire-plugin.noarch 2.19.1-8.fc27 metrics.noarch 3.1.2-5.fc27 metrics-jvm.noarch 3.1.2-5.fc27 metrics-reporter-config.noarch 3.2.2-2.fc27 objectweb-asm3.noarch 3.3.1-15.fc27 ohc.noarch 0.6.1-1.fc27 parboiled.noarch 1.1.6-12.fc27 pegdown.noarch 1.4.2-11.fc27 plexus-archiver.noarch 3.4-3.fc27 plexus-compiler.noarch 2.8.1-5.fc27 plexus-component-api.noarch 1.0-0.23.alpha15.fc27 plexus-i18n.noarch 1.0-0.10.b10.4.fc27 plexus-interactivity-api.noarch 1.0-0.24.alpha6.fc27 plexus-io.noarch 2.7.1-3.fc27 python-blist.x86_64 1.3.6-12.fc27 python-scales.noarch 1.0.5-10.fc27 python2-futures.noarch 3.1.1-2.fc27 python2-simplejson.x86_64 3.10.0-5.fc27 python3-blist.x86_64 1.3.6-12.fc27 python3-scales.noarch 1.0.5-10.fc27 python3-simplejson.x86_64 3.10.0-5.fc27 sigar.x86_64 1.6.5-0.20.git58097d9.fc27 sigar-java.x86_64 1.6.5-0.20.git58097d9.fc27 snappy-java.x86_64 1.1.2.4-8.fc27 sonatype-oss-parent.noarch 7-13.fc27 stream-lib.noarch 2.6.0-8.fc27 xmlunit.noarch 1.6-6.fc27 Complete! |
Starting Cassandra
After you install Cassandra, you can start it as any sudoer user with the following syntax:
sudo cassandra -R |
Using Cassandra
You can connect to the Cassandra server with the cqlsh
client software. You use the following syntax:
cqlsh |
You should see the Cassandra version information, and then you can type help
at the cqlsh>
prompt to see the available commands:
Connected TO Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.11.1 | 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 |
Here’s my script that creates Cassandra keyspace, which is more or less a database. You use the USE
command to connect to the keyspace or database, like you would in MySQL. You do not have sequences in Cassandra because they’re not a good fit for a distributed architecture. Cassandra does not support a native procedural extension like relational databases. You must create User-defined functions (UDFs) by embedding the logic in Java.
This script does the following:
- Creates a keyspace
- Uses the keyspace
- Conditionally drops tables and functions
- Creates two tables
- Inserts data into the two tables
- Queries data from the tables
I also included a call to a UDF inside a query in two of the examples. One of the queries demonstrates how to return a JSON structure from a query. To simplify things and provide clarification of the scripts behaviors, the details are outlined below.
- The first segment of the script creates the keyspace, changes the scope to use the keyspace, conditionally drop tables, create tables, and insert values into the tables:
/* Create a keyspace in Cassandra, which is like a database in MySQL or a schema in Oracle. */ CREATE KEYSPACE IF NOT EXISTS student WITH REPLICATION = { 'class':'SimpleStrategy' ,'replication_factor': 1 } AND DURABLE_WRITES = true; /* Use the keyspace or connect to the database. */ USE student; /* Drop the member table from the student keyspace. */ DROP TABLE IF EXISTS member; /* Create a member table in the student keyspace. */ CREATE TABLE member ( member_number VARCHAR , member_type VARCHAR , credit_card_number VARCHAR , credit_card_type VARCHAR , PRIMARY KEY ( member_number )); /* Conditionally drop the contact table from the student keyspace. */ DROP TABLE IF EXISTS contact; /* Create a contact table in the student keyspace. */ CREATE TABLE contact ( contact_number VARCHAR , contact_type VARCHAR , first_name VARCHAR , middle_name VARCHAR , last_name VARCHAR , member_number VARCHAR , PRIMARY KEY ( contact_number )); /* Insert a row into the member table. */ INSERT INTO member ( member_number, member_type, credit_card_number, credit_card_type ) VALUES ('SFO-12345','GROUP','2222-4444-5555-6666','VISA'); /* Insert a row into the contact table. */ INSERT INTO contact ( contact_number, contact_type, first_name, middle_name, last_name, member_number ) VALUES ('CUS_00001','FAMILY','Barry', NULL,'Allen','SFO-12345'); /* Insert a row into the contact table. */ INSERT INTO contact ( contact_number, contact_type, first_name, middle_name, last_name, member_number ) VALUES ('CUS_00002','FAMILY','Iris', NULL,'West-Allen','SFO-12345'); /* Insert a row into the member table. */ INSERT INTO member ( member_number, member_type, credit_card_number, credit_card_type ) VALUES ('SFO-12346','GROUP','3333-8888-9999-2222','VISA'); /* Insert a row into the contact table. */ INSERT INTO contact ( contact_number, contact_type, first_name, middle_name, last_name, member_number ) VALUES ('CUS_00003','FAMILY','Caitlin','Marie','Snow','SFO-12346');
- The following queries the member table:
/* Select all columns from the member table. */ SELECT * FROM member;
It returns the following:
member_number | credit_card_number | credit_card_type | member_type ---------------+---------------------+------------------+------------- SFO-12345 | 2222-4444-5555-6666 | VISA | GROUP SFO-12346 | 3333-8888-9999-2222 | VISA | GROUP
- Create a
concatenate
User-defined function (UDF) for Cassandra. The first step requires you to edit thecassandra.yaml
file, which you find in the/etc/cassandra/default.conf
directory. There is a single parameter that you need to edit, and it is theenable_user_defined_functions
parameter. By default the parameter is set tofalse
, and you need to enable it to create UDFs.After you make the edit, the
cassandra.yaml
file should look like this:1089 1090 1091 1092 1093
# If unset, all GC Pauses greater than gc_log_threshold_in_ms will log at # INFO level # UDFs (user defined functions) are disabled by default. # As of Cassandra 3.0 there is a sandbox in place that should prevent execution of evil code. enable_user_defined_functions: true
After you make the change, you can create your own UDF. The following UDF formats the first, middle, and last name so there’s only one whitespace between the first and last name when there middle name value is null.
This type of function must use a
CALLED ON NULL INPUT
clause in lieu of aRETURNS NULL ON NULL INPUT
clause. The latter would force the function to return a null value if any one of the parameters were null./* Drop the concatenate function because a replace disallows changing a RETURNS NULL ON NULL INPUT with a CALLED ON NULL INPUT without raising an "89: InvalidRequest" exception. */ DROP FUNCTION concatenate; /* Create a user-defined function to concatenate names. */ CREATE OR REPLACE FUNCTION concatenate (first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR) CALLED ON NULL INPUT RETURNS VARCHAR LANGUAGE java AS $$ /* Concatenate first and last names when middle name is null, and first, middle, and last names when middle name is not null. */ String name; /* Check for null middle name. */ if (middle_name == null) { name = first_name + " " + last_name; } else { name = first_name + " " + middle_name + " " + last_name; } return name; $$;
- Query the values from the
contact
table with the UDF function in theSELECT
-list:/* Query the contact information. */ SELECT member_number , contact_number , contact_type , concatenate(first_name, middle_name, last_name) AS full_name FROM contact;
It returns the following:
member_number | contact_number | contact_type | full_name ---------------+----------------+--------------+-------------------- SFO-12345 | CUS_00001 | FAMILY | Barry Allen SFO-12345 | CUS_00002 | FAMILY | Iris West-Allen SFO-12346 | CUS_00003 | FAMILY | Caitlin Marie Snow
- Query the values from the
contact
table with a JSON format:/* Query the contact information and return in a JSON format. */ SELECT JSON contact_number , contact_type , concatenate(first_name, middle_name, last_name) AS full_name FROM contact;
It returns the following:
[json] ------------------------------------------------------------------------------------------------- {"contact_number": "CUS_00001", "contact_type": "FAMILY", "full_name": "Barry Allen"} {"contact_number": "CUS_00002", "contact_type": "FAMILY", "full_name": "Iris West-Allen"} {"contact_number": "CUS_00003", "contact_type": "FAMILY", "full_name": "Caitlin Marie Snow"}
You can call the script from a relative directory inside cqlsh
, like this:
SOURCE 'cstudent.cql' |
At the end of the day, the concept of adding and removing nodes is attractive. Though, the lack of normal relational mechanics and narrowly supported set of CQL semantics leaves me with open questions. For example, is clustering without a coordinator really valuable enough to settle for eventual, or tunable, consistency with such a narrowly scoped query language?
As always, I hope this helps those looking for a quick how-to on Cassandra.