Skip to content

Building Apache Cassandra 3.11

aborkar-ibm edited this page Feb 23, 2018 · 22 revisions

Building Apache Cassandra

The instructions provided below specify the steps to build Apache Cassandra version 3.11.1 on Linux on IBM Z for the following distributions:

  • RHEL (7.3, 7.4)
  • SLES (12 SP2, 12 SP3)
  • Ubuntu (16.04, 17.10)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writeable directory anywhere you'd like to place it.

Step 1: Building and installing Apache Cassandra

1.1) Install dependencies

  • RHEL (7.3, 7.4)

    sudo yum install git which java-1.8.0-openjdk-devel.s390x gcc-c++ make automake autoconf libtool libstdc++-static tar wget patch words libXt-devel libX11-devel texinfo unzip python
  • SLES (12 SP2, 12 SP3)

    sudo zypper install git which make wget tar zip unzip words gcc-c++ patch libtool automake autoconf ccache java-1_8_0-openjdk-devel xorg-x11-proto-devel xorg-x11-devel alsa-devel cups-devel libffi48-devel libstdc++6-locale glibc-locale libstdc++-devel libXt-devel libX11-devel texinfo unzip python
  • Ubuntu (16.04, 17.10)

    sudo apt-get update
    sudo apt-get install git tar g++ make automake autoconf libtool  wget patch libx11-dev libxt-dev openjdk-8-jre openjdk-8-jdk pkg-config texinfo locales-all unzip python

1.2) Install Ant

cd /<source_root>/
wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz
tar -xvf apache-ant-1.9.4-bin.tar.gz

1.3) Set environment variables

export LANG="en_US.UTF-8"
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
export JAVA_HOME=<path to Java>
export ANT_OPTS="-Xms4G -Xmx4G"
export ANT_HOME=/<source_root>/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin

1.4) Download source code

cd /<source_root>/
git clone https://github.com/apache/cassandra.git
cd cassandra
git checkout cassandra-3.11.1

1.5) Update build parameters to solve the "StackOverflow" error in execution

sed  -i 's/Xss256k/Xss32m/g' build.xml conf/jvm.options

1.6) Build Apache Cassandra:

cd /<source_root>/cassandra
ant

Note: If JDK 8u161 breaks JMX integration then update '/<source_root>/cassandra/src/java/org/apache/cassandra/utils/JMXServerUtils.java` as shown below:

@@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
 import com.sun.jmx.remote.internal.RMIExporter;
 import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
 import org.apache.cassandra.auth.jmx.AuthenticationProxy;
+import sun.misc.ObjectInputFilter;
 import sun.rmi.registry.RegistryImpl;
 import sun.rmi.server.UnicastServerRef2;

@@ -308,10 +309,10 @@ public class JMXServerUtils
         // to our custom Registry too.
         private Remote connectorServer;

-         public Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
+         public Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf, ObjectInputFilter filter)
         throws RemoteException
         {
-            Remote remote = new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
+            Remote remote = new UnicastServerRef2(port, csf, ssf, filter).exportObject(obj, null, true);
             // Keep a reference to the first object exported, the JMXConnectorServer
             if (connectorServer == null)
                 connectorServer = remote;

Step 2: Replace x86 specific jar files

  • Replace Snappy-Java

    cd /<source_root>/cassandra
    rm lib/snappy-java-1.1.1.7.jar
    wget -O lib/snappy-java-1.1.2.6.jar http://central.maven.org/maven2/org/xerial/snappy/snappy-java/1.1.2.6/snappy-java-1.1.2.6.jar 
  • Build and replace JNA

    cd /<source_root>/
    git clone https://github.com/java-native-access/jna.git
    cd jna
    git checkout 4.2.2
    ant
    rm /<source_root>/cassandra/lib/jna-4.2.2.jar
    cp build/jna.jar /<source_root>/cassandra/lib/jna-4.2.2.jar

Step 3: Run test suite (Optional)

cd /<source_root>/cassandra/
ant test
  • Below mentioned tests fail on s390x as they use testdata which is generated for Little Endian. Hence these failures can be ignored:

    testFilterOutDuplicates
    testUpgradeSstablesWithDuplicates
    testReadingLegacyIndexedSSTableWithStaticColumns
    testStreamLegacyCqlTables
    testLoadLegacyCqlTables
    testLoadLegacyCqlTablesShallow
    testReverseIterationOfLegacyIndexedSSTable
    testVersions
    testSSTableExport_WithArgs
  • The test testTableRebuild fails with OpenJDK zero variant.

Note: You may resolve other testcase failures by applying the following changes:

  • Increase timeout in /<source_root>/casssandra/build.xml as shown below for timeout related testcase failure
    @@ -97,7 +97,7 @@
      <property name="maven-repository-url" value="https://repository.apache.org/content/repositories/snapshots"/>
      <property name="maven-repository-id" value="apache.snapshots.https"/>
    - <property name="test.timeout" value="240000" />
    + <property name="test.timeout" value="600000" />
      <property name="test.long.timeout" value="600000" />
      <property name="test.burn.timeout" value="600000" />
  • Change the key cache size as per requirement in /<source_root>/cassandra/test/conf/cassandra.yaml
    @@ -44,3 +44,4 @@ row_cache_class_name: org.apache.cassandra.cache.OHCProvider
     row_cache_size_in_mb: 16
     enable_user_defined_functions: true
     enable_scripted_user_defined_functions: true
    + key_cache_size_in_mb: 12

Step 4: Start Cassandra Server(Optional)

./<source_root>/cassandra/bin/cassandra -f

Start an interactive client as follows in another session after the server is ready

cd /<source_root>/cassandra
bin/cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.1-SNAPSHOT | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Type in following commands:

cqlsh> CREATE SCHEMA schema1
   WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> USE schema1;
cqlsh:Schema1> CREATE TABLE users (
             user_id varchar PRIMARY KEY,
             first varchar,
             last varchar,
             age int
           );
cqlsh:Schema1> INSERT INTO users (user_id, first, last, age)
           VALUES ('jsmith', 'John', 'Smith', 42);
cqlsh:Schema1> SELECT * FROM users;
user_id | age | first | last
---------+-----+-------+-------
jsmith |  42 |  john | smith
cqlsh:Schema1>

If your session looks similar to what's above, congrats, your single node cluster is operational!

References:

http://cassandra.apache.org/

Clone this wiki locally