Software

Ubuntu 安裝 Apache Cassandra

安裝 OpenJDK

sudo apt update && \
sudo apt install openjdk-8-jdk

安裝 apt-transport-https

sudo apt install apt-transport-https

匯入 GPG Key

wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -

新增 Add Repo

echo "deb http://www.apache.org/dist/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

安裝 Cassandra DB

sudo apt update && \
sudo apt install cassandra

確認 Cassandra Service 運作

systemctl status cassandra

###運作正常
● cassandra.service - LSB: distributed storage system for structured data
     Loaded: loaded (/etc/init.d/cassandra; generated)
     Active: active (running) since Tue 2022-05-03 00:53:18 UTC; 3min 59s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 41 (limit: 1066)
     Memory: 740.4M
     CGroup: /system.slice/cassandra.service
             └─39460 /usr/bin/java -ea -da:net.openhft... -XX:+UseThreadPriorities -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:+AlwaysPreTouch -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+UseNUMA -XX:+PerfDisableSharedMem -D>

May 03 00:53:18 casd systemd[1]: Starting LSB: distributed storage system for structured data...
May 03 00:53:18 casd systemd[1]: Started LSB: distributed storage system for structured data.

確認 Nodetool 狀態

nodetool status

###運作中
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  69.04 KiB  16      100.0%            2118d917-7acd-466c-9b4b-20c87cdd313a  rack1