ApacheCassandra is a distributed, scalable, highly available, and fault-tolerant NoSQL database. It was first developed by facebook and then contributed to the Apache Foundation. Cassandra's data model is inspired by GoogleBigtable, and its distributed model is inspired by AmazonDynamo. If you want to learn more about Cassandra's design details, refer to a Facebook paper. This article describes
Apache Cassandra is a distributed, scalable, highly available, and fault-tolerant NoSQL database. It was first developed by facebook and then contributed to the Apache Foundation. Cassandra's data model is inspired by Google Bigtable, and its distributed model is inspired by Amazon Dynamo. If you want to learn more about Cassandra's design details, refer to a Facebook paper.
This article describes how to install Cassandra on Ubuntu 12.04.
- Run the following command to install the new update:
- Open/etc/apt/sources. list
1 |
sudo gedit /etc/apt/sources.list |
Add the following content to the sources. list file:
1 |
deb http://www.apache.org/dist/cassandra/debian 10x main |
2 |
deb-src http://www.apache.org/dist/cassandra/debian 10x main |
- Register and add the PGP key and update it again. Note that you need to modify the key accordingly.
1 |
gpg --keyserver wwwkeys.pgp.net --recv-keys 4BD736A82B5C1B00 |
2 |
sudo apt-key add ~/.gnupg/pubring.gpg |
- Start to install Cassandra
1 |
sudo apt-get install cassandra |
- Start Cassandra Server
After startup, you will see the following information:
4 |
INFO 12:18:29,140 Listening for thrift clients... |
- To stop a process on the Cassandra server, you must first find its process id.
1 |
ps auwx | grep cassandra |
The following output information indicates that the process id is 3595.
1 |
root 3595 0.0 0.0 60048 1908 pts/0 S+ 12:18 0:00 sudo cassandra -f |
Then use the kill command to terminate the Cassandra Service (although this method is rough)
After the process is stopped, you can see the following information in Thrift:
1 |
INFO 13:04:08,663 Stop listening to thrift clients |
2 |
INFO 13:04:08,666 Waiting for messaging service to quiesce |
3 |
INFO 13:04:08,667 MessagingService shutting down server thread. |
- You can also use the following command to start the Cassandra service.
1 |
sudo /etc/init.d/cassandra start |
- Run the following command to stop the Cassandra service:
1 |
sudo /etc/init.d/cassandra stop |
Install Cassandra and create the following directory:
- /Var/lib/cassandra (data directories)
- /Var/log/cassandra (log directory)
- /Var/run/cassandra (runtime files)
- /Usr/share/cassandra (environment settings)
- /Usr/share/cassandra/lib (JAR files)
- /Usr/bin (binary files)
- /Usr/sbin
- /Etc/cassandra (configuration files)
- /Etc/init. d (service startup script)
- /Etc/security/limits. d (cassandra user limits)
- /Etc/default
Installing JNA on Linux will optimize Cassandra's memory usage. To install JNA, you only need to download jna from here. jar file, and save the file to the/usr/share/cassandra/lib directory.
If the following error occurs when you start the Cassandra server, it may be that Cassandra has started. You need to stop the running service first.
1 |
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 7199; nested exception is: |
2 |
java.net.BindException: Address already in use |
You can also use the binary installation method. For more information, see here.
Original English, OSCHINA Original translation