Πώς να ρυθμίσετε Cassandra Cluster σε πολλαπλούς κόμβους
⚡ Έξυπνη Σύνοψη
Cassandra Cluster groups multiple nodes so that data is distributed and no single machine holds everything. This page explains cluster components, the partitioner and token ring, prerequisites, the configuration settings that join nodes together, and how to verify the result.

Τι είναι Cassandra Cluster?
A Cassandra Το σύμπλεγμα είναι ένα από τα κελύφη στο σύνολο Cassandra βάση δεδομένων. Η Cassandra cluster contains numerous different layers of storage units, and each layer contains the other.
Μεγάλη οργάνωση όπως π.χ Amazon, Facebook, etc. have a huge amounts of data to manage. So these organizations cannot store that huge amount of data on the single machine. This is when they use databases like Cassandra με κατανεμημένη αρχιτεκτονική.
These organizations store that huge amount of data on multiple nodes. These nodes communicate with each other. For this purpose, Cassandra συστάδα.
- Cluster is basically a group of nodes, so that nodes can communicate with each other easily.
- Coordinator node is the node that receives a client request and communicates with the replicas on that client’s behalf. Any node can act as coordinator for any request.
Χωρίζων
Ένας διαχωριστής καθορίζει τον τρόπο διανομής των δεδομένων στο σύμπλεγμα. Το Partitioner χρησιμοποιεί μια συνάρτηση κατακερματισμού για τη διανομή δεδομένων στο σύμπλεγμα. Απαιτείται κλειδί διαμερίσματος για τον υπολογισμό του κατακερματισμού. Αυτό το hash λέγεται ένδειξη. Τα δεδομένα διανέμονται με βάση αυτό το διακριτικό.
The default partitioner is Murmur3Partitioner, which produces tokens spread evenly across a fixed range. Every node owns one or more ranges of that range, and the collection of ranges forms the δαχτυλίδι με κουπόνι. Because assignment is by hash rather than by value, adding a node moves only the ranges it takes over rather than reshuffling the whole dataset.
Προαπαιτούμενα για Cassandra Cluster
Υπάρχουν οι ακόλουθες απαιτήσεις για τη ρύθμιση συμπλέγματος.
- You should have multiple machines, physical or virtual, acting as nodes.
- Nodes must be able to reach each other on the network. Ports 7000 for internode traffic, 7001 if TLS is enabled, and 9042 for client connections must be open between them.
- Linux should be installed on each node. It is the platform Cassandra is tested and supported on.
- Apache Cassandra must be installed on every node, at the same version. Mixed versions cannot complete a schema agreement.
- Ένα υποστηριζόμενο JDK must be installed on each machine, with JAVA_HOME set.
- Clocks must be synchronised with NTP. Cassandra resolves conflicting writes by timestamp, so clock drift silently produces wrong results.
The last requirement is the one most often missed, and it causes data problems rather than startup failures.
.
Πώς να εγκαταστήσετε Cassandra Cluster σε Linux
Cassandra must be installed on each machine before any of them can join a cluster. The screenshots below come from the DataStax Enterprise graphical installer, which was the common route when this walkthrough was written. That installer is no longer distributed for community use, so the current approach is given first and the wizard follows for reference.
Current method: εγκαταστήσετε το Apache Cassandra package or binary tarball on every node identically, then verify each one starts on its own before attempting to join them.
tar -xzf apache-cassandra-x.y.z-bin.tar.gz -C /opt/ export CASSANDRA_HOME=/opt/apache-cassandra-x.y.z $CASSANDRA_HOME/bin/cassandra -f
Once a single node starts cleanly, stop it, clear its data directory, and move on to the cluster configuration section below.
Βήμα 1) Εκτελέστε το Cassandra enterprise edition setup. On Linux terminal, run the setup. The following page will be displayed.
Αυτή η σελίδα δεν παρέχει καμία απαραίτητη πληροφορία. Απλώς παρέχει πληροφορίες για το Cassandra εκδοχή. Περάστε λοιπόν αυτή τη σελίδα και πατήστε το κουμπί επόμενο.
Βήμα 2) Accept the license agreement. After pressing next button following page will be displayed.
Αυτή η σελίδα παρέχει πληροφορίες σχετικά με τα πακέτα και τα υποπακέτα στο Cassandra that is going to be installed. Below it will ask about the license. Check the checkbox ‘I accept the agreement’ and press next button.
Βήμα 3) Install Builder and Click Next. After pressing next button, you will see the following page.
Αυτή η σελίδα σάς ρωτά για τις επιλογές εγκατάστασης.
- Πρώτα απ 'όλα, θα ζητήσει τον κατάλογο εγκατάστασης. Από προεπιλογή, είναι εγκατεστημένο στον αρχικό κατάλογο.
- Στη συνέχεια, ρωτά για τον τύπο εγκατάστασης, επιλέξτε Απλή εγκατάσταση.
- Στη συνέχεια, ρωτά για το σύστημα ενημέρωσης, ελέγξτε το 'όχι'.
- Next, it asks for default interface. There are two options, you can install on the localhost or select IP address. Select IP address for installation.
- Πατήστε το επόμενο κουμπί.
Βήμα 4) Setup Node and Click Next. After pressing the next button the following page will be displayed.
Αυτή η σελίδα ρωτά για τη ρύθμιση του κόμβου.
- First, select Node type ‘Cassandra Node’.
- Στη συνέχεια, στο Όνομα δακτυλίου, δώστε το όνομα του συμπλέγματός σας. Cluster Το όνομα πρέπει να είναι ίδιο για όλους τους κόμβους στο ίδιο σύμπλεγμα.
- Next, select the seed. Seed is the node which other non-seed nodes contact when they start.
- Αφού δώσετε αυτές τις πληροφορίες, πατήστε το κουμπί επόμενο.
Βήμα 5) Install the monitoring agent. After pressing next button, the following page will be displayed. This page asks for the IP address where the agent should be installed.
- The agent is needed for the monitoring console, where all nodes can be observed in one place.
- Αφού δώσετε αυτές τις πληροφορίες, πατήστε το κουμπί επόμενο.
Βήμα 6) Press next for Installation. After pressing the next button the following page will be displayed.
Τώρα η εγκατάσταση είναι έτοιμη για εγκατάσταση. Πατήστε το κουμπί επόμενο.
Βήμα 7) Wait for Installation Process. After pressing next button, following page will be displayed.
Setup will start installing.
Βήμα 8) Click On Finish Button. After the installation, following page will be displayed. On the same page, you will see the check mark for the option which appears by default.
Configuring cassandra.yaml to Join Nodes
Installation alone does not create a cluster. Nodes only find each other once four settings in cassandra.yaml agree, and this file is where most cluster setups go wrong.
cluster_name: 'Guru99 Cluster' seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "192.168.1.10,192.168.1.11" listen_address: 192.168.1.10 rpc_address: 0.0.0.0 broadcast_rpc_address: 192.168.1.10 endpoint_snitch: GossipingPropertyFileSnitch
- cluster_name must match on every node. A mismatch is the most common cause of a node refusing to join.
- σπόροι lists the contact points a starting node gossips with. Two or three seeds per data centre is enough; making every node a seed prevents automatic bootstrapping.
- listen_address is the address other nodes use to reach this one. It must be a real routable address, never localhost.
- endpoint_snitch λέει Cassandra the rack and data centre layout. GossipingPropertyFileSnitch is the usual choice, with values set in cassandra-rackdc.properties.
Changing the snitch or cluster name after data exists requires extra steps, so both should be decided before the first node starts.
Ξεκινήστε Cassandra Κόμβος
Μετά την εγκατάσταση Cassandra on each node, start the servers and follow the steps below. Order matters: start the seed nodes first, one at a time, waiting for each to report as up before starting the next. Starting several nodes simultaneously can produce token range conflicts.
Βήμα 1) Πηγαίνετε στο Cassandra installation directory and start the server.
bin/cassandra -f
By executing this command, the Cassandra server will be started. Here is the screenshot where the Cassandra server is starting.
After roughly a minute the server will be up. Start each node server one by one. After starting all the node servers, your Cassandra το σύμπλεγμα είναι έτοιμο για χρήση.
Βήμα 2) Verify that every node has joined by checking the ring from any one of them.
nodetool status nodetool describecluster
Every node should appear with status UN, meaning Up and Normal, and the Owns column should show roughly equal percentages. A single schema version in describecluster output confirms all nodes agree on the schema.
Three symptoms cover most failures. A node that never appears usually has a mismatched cluster_name or a blocked port 7000. A node stuck at UJ, joining, is still streaming data and simply needs time on a large cluster. Wildly uneven ownership points at a snitch misconfiguration, where nodes were placed in the wrong rack or data centre.
With the ring healthy, replication settings for each keyspace decide how data spreads across it, as described in the Cassandra keyspace tutorial and the Cassandra αρχιτεκτονική έπαθε βλάβη.










