When I run nodetool status
this error is thrown:
root@cassandra-cluster-01:/home# nodetool -h 192.168.2.228 status
nodetool: Failed to connect to '192.168.2.228:7199' - URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[192.168.2.228]:7199'.
root@cassandra-cluster-01:/home# nodetool status
nodetool: Failed to connect to '127.0.0.1:7199' - URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199'.
The way the Cassandra 2.x was installed (What could be wrong with this?):
#!/bin/bash
# Define variables
CASSANDRA_VERSION="2.2.19" # Specific 2.x version to install
NODE_IP="192.168.2.228" # IP address for the current VM and seed node
# Update package lists and install prerequisites
apt-get update -y
apt-get install -y wget gnupg2 lsb-release
# Install Zulu JDK 8
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B1998361219BD9C9
echo "deb http://repos.azulsystems.com/debian stable main" | tee /etc/apt/sources.list.d/zulu.list
apt-get update -y
apt-get install -y zulu-8
# Verify Java installation
java -version
# Download and install Cassandra
wget https://archive.apache.org/dist/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz
tar -xvf apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz
mv apache-cassandra-$CASSANDRA_VERSION /opt/cassandra
# Create symbolic links
ln -s /opt/cassandra/bin/* /usr/local/bin/
# Download jamm-0.3.0.jar and place it in the lib directory
wget https://repo1.maven.org/maven2/com/github/stephenc/jamm/0.3.0/jamm-0.3.0.jar -P /opt/cassandra/lib/
# Set up environment variables for Cassandra
cat <<EOF > /etc/profile.d/cassandra.sh
export CASSANDRA_HOME=/opt/cassandra
export PATH=$PATH:$CASSANDRA_HOME/bin
EOF
source /etc/profile.d/cassandra.sh
# Ensure permissions are set correctly
chmod -R 755 /opt/cassandra
# Update JVM options to include the jamm agent
cat <<EOF >> /opt/cassandra/conf/cassandra-env.sh
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
EOF
# Create Cassandra service
cat <<EOF > /etc/systemd/system/cassandra.service
[Unit]
Description=Apache Cassandra
After=network.target
[Service]
Type=simple
ExecStart=/opt/cassandra/bin/cassandra -f
ExecStop=/bin/kill -9 $(cat /opt/cassandra/cassandra.pid)
User=root
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Reload systemd to recognize the new service
systemctl daemon-reload
# Stop Cassandra to configure
systemctl stop cassandra
# Configure Cassandra
sed -i "s/^# broadcast_rpc_address: 1.2.3.4/broadcast_rpc_address: $NODE_IP/" /opt/cassandra/conf/cassandra.yaml
sed -i "s/^listen_address: localhost/listen_address: $NODE_IP/" /opt/cassandra/conf/cassandra.yaml
sed -i "s/^rpc_address: localhost/rpc_address: $NODE_IP/" /opt/cassandra/conf/cassandra.yaml
sed -i "s/^- seeds: "127.0.0.1"/- seeds: "$NODE_IP"/" /opt/cassandra/conf/cassandra.yaml
# Enable auto_bootstrap
echo "auto_bootstrap: true" | tee -a /opt/cassandra/conf/cassandra.yaml
# Start Cassandra service
systemctl start cassandra
# Enable Cassandra to start on boot
systemctl enable cassandra
# Verify Cassandra installation
nodetool status
# Provide information about the installation
echo "Cassandra installation and initial configuration completed. Please check the nodetool status above for cluster status."