Last active
March 8, 2019 00:58
-
-
Save DorkNstein/bb582db98f87133b7f590bf8a4509281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum -y update | |
sudo yum install java | |
java -version | |
echo $JAVA_HOME | |
#If you get a null or blank output, you will need to manually set the JAVA_HOME variable. | |
sudo vi ~/.bash_profile | |
# ADD following lines | |
export JAVA_HOME=/usr/java/jdk1.8.0_191/ | |
export JRE_HOME=/usr/java/jdk1.8.0_191/jre | |
# :qw! save & quit | |
source ~/.bash_profile | |
echo $JAVA_HOME # Should print 1.8.0_191 | |
## Installing Cassandra | |
sudo vi /etc/yum.repos.d/cassandra.repo | |
# Add the lines | |
[cassandra] | |
name=Apache Cassandra | |
baseurl=https://www.apache.org/dist/cassandra/redhat/311x/ | |
gpgcheck=1 | |
repo_gpgcheck=1 | |
gpgkey=https://www.apache.org/dist/cassandra/KEYS | |
sudo yum -y install cassandra | |
sudo systemctl daemon-reload | |
sudo systemctl start cassandra | |
sudo systemctl enable cassandra # To enable Cassandra to automatically start at boot time | |
sudo systemctl status cassandra | |
# ENV file location | |
sudo vi /etc/cassandra/default.conf/cassandra-env.sh | |
## Yaml file location | |
sudo vi /etc/cassandra/conf/cassandra.yaml | |
# Set these values | |
cluster_name: 'Test Cluster' | |
auto_bootstrap: false | |
listen_address: 10.0.0.197 | |
broadcast_address: 10.0.0.197 | |
rpc_address: 0.0.0.0 | |
broadcast_rpc_address: 52.205.10.16 | |
start_rpc: true | |
seed_provider: | |
- class_name: org.apache.cassandra.locator.SimpleSeedProvider | |
parameters: | |
- seeds: "10.0.0.197" | |
# Check if Cassandra is running | |
nodetool status | |
# ==> Should output | |
``` | |
Datacenter: datacenter1 | |
======================= | |
Status=Up/Down | |
|/ State=Normal/Leaving/Joining/Moving | |
-- Address Load Tokens Owns (effective) Host ID Rack | |
UN 172.31.37.153 160.71 KiB 256 100.0% 8c2a48b8-cdad-401a-8b97-0c7473d1e67b rack1 | |
``` | |
# Log files location | |
tail -f /var/log/cassandra/cassandra.log | |
## To rename the cluster | |
cqlsh> UPDATE system.local SET cluster_name = 'New Cluster' where key='local'; | |
cqlsh> quit | |
nodetool flush | |
sudo vi /etc/cassandra/conf/cassandra.yaml | |
>> cluster_name: 'New Cluster' | |
## Check remote connection | |
cqlsh <public IP> | |
# If above connection fails | |
sudo vi /etc/cassandra/default.conf/cassandra-env.sh | |
# >> Uncomment following line & replace <public name> with public IP | |
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public ip>" | |
## OPEN PORT 9042 in AWS Security group |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment