From 9da36969a7f15b5b23d28808643f0b70c457b175 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Sun, 18 Aug 2024 16:02:37 +0300 Subject: [PATCH 1/7] initial commit for persistence_replication.md --- persistence_replication.md | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 persistence_replication.md diff --git a/persistence_replication.md b/persistence_replication.md new file mode 100644 index 0000000..25d2a66 --- /dev/null +++ b/persistence_replication.md @@ -0,0 +1,120 @@ +--- +title: "Persistence and Replication" +nav_order: 8 +description: "Configuring FalkorDB Docker for Persistence and Replication +" +--- + +# Configuring FalkorDB Docker for Persistence and Replication + +FalkorDB supports advanced configurations to enable data persistence and replication, ensuring that your data is safe and available across different instances. This guide will walk you through setting up FalkorDB in Docker with persistence and replication enabled. + +## Prerequisites + +Before you begin, ensure you have the following: + + * Docker installed on your machine. + * A working FalkorDB Docker image. You can pull it from Docker Hub. + * Basic knowledge of Docker commands and configurations. + +## Step 1: Setting Up Persistence + +Persistence in FalkorDB allows you to store your data on the host machine, ensuring that it is not lost when the container restarts. + +### 1.1 Create a Persistent Volume + +First, create a Docker volume to store the data: + +```bash +docker volume create falkordb_data +``` + +This volume will be used to store the database files. + +### 1.2 Start FalkorDB with the Persistent Volume + +You can now run FalkorDB with the volume attached: + +```bash +docker run -d \ + --name falkordb \ + -v falkordb_data:/data \ + falkordb/falkordb +``` + +In this configuration: + + The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. + FalkorDB will use this directory to store its data. + +## Step 2: Configuring Replication + +Replication ensures that your data is available across multiple FalkorDB instances. You can configure one instance as the master and others as replicas. + +### 2.1 Setting Up the Master Instance + +Start the master FalkorDB instance: + +```bash +docker run -d \ + --name falkordb-master \ + -v falkordb_data:/data \ + -e REPLICATION_MODE=master \ + -e REPLICATION_ID=master1 \ + falkordb/falkordb +``` + +Here: + + The -e REPLICATION_MODE=master flag sets this instance as the master. + The -e REPLICATION_ID=master1 assigns a unique ID to the master. + +### 2.2 Configuring the Replica Instances + +Next, start the replica instances that will replicate data from the master: + +```bash +docker run -d \ + --name falkordb-replica1 \ + -e REPLICATION_MODE=replica \ + -e REPLICATION_MASTER_HOST=falkordb-master \ + -e REPLICATION_ID=replica1 \ + falkordb/falkordb +``` + +In this setup: + + * The -e REPLICATION_MODE=replica flag sets the instance as a replica. + * The -e REPLICATION_MASTER_HOST=falkordb-master flag specifies the master instance's hostname or IP address. + * The -e REPLICATION_ID=replica1 assigns a unique ID to this replica. + +You can add additional replicas by repeating the command with different container names and REPLICATION_IDs. + +## Step 3: Verifying the Setup + +To verify that your setup is working correctly: + + * Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. + +```bash + docker stop falkordb + docker start falkordb +``` + + * Replication Check: Insert some data into the master instance and check if it is available in the replica. + +```bash + # Connect to the master + docker exec -it falkordb-master /bin/bash + falkordb-cli set key "Hello, FalkorDB!" + exit + + # Connect to the replica + docker exec -it falkordb-replica1 /bin/bash + falkordb-cli get key + # Output should be "Hello, FalkorDB!" +``` + +## Conclusion + +With persistence and replication configured, FalkorDB is now set up for reliable data storage and high availability. You can scale this setup by adding more replicas or by implementing Redis Sentinel for automatic failover. \ No newline at end of file From 6c72ec2a5671dd8dfec877fee693b4a4b126ece6 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Sun, 18 Aug 2024 16:09:42 +0300 Subject: [PATCH 2/7] fix docs --- persistence_replication.md | 53 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/persistence_replication.md b/persistence_replication.md index 25d2a66..f859d34 100644 --- a/persistence_replication.md +++ b/persistence_replication.md @@ -13,9 +13,9 @@ FalkorDB supports advanced configurations to enable data persistence and replica Before you begin, ensure you have the following: - * Docker installed on your machine. - * A working FalkorDB Docker image. You can pull it from Docker Hub. - * Basic knowledge of Docker commands and configurations. +* Docker installed on your machine. +* A working FalkorDB Docker image. You can pull it from Docker Hub. +* Basic knowledge of Docker commands and configurations. ## Step 1: Setting Up Persistence @@ -36,16 +36,13 @@ This volume will be used to store the database files. You can now run FalkorDB with the volume attached: ```bash -docker run -d \ - --name falkordb \ - -v falkordb_data:/data \ - falkordb/falkordb +docker run -d --name falkordb -v falkordb_data:/data -p 6379:6379 falkordb/falkordb ``` In this configuration: - The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. - FalkorDB will use this directory to store its data. +The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. +FalkorDB will use this directory to store its data. ## Step 2: Configuring Replication @@ -61,13 +58,14 @@ docker run -d \ -v falkordb_data:/data \ -e REPLICATION_MODE=master \ -e REPLICATION_ID=master1 \ + -p 6379:6379 \ falkordb/falkordb ``` Here: - The -e REPLICATION_MODE=master flag sets this instance as the master. - The -e REPLICATION_ID=master1 assigns a unique ID to the master. +The -e REPLICATION_MODE=master flag sets this instance as the master. +The -e REPLICATION_ID=master1 assigns a unique ID to the master. ### 2.2 Configuring the Replica Instances @@ -79,14 +77,15 @@ docker run -d \ -e REPLICATION_MODE=replica \ -e REPLICATION_MASTER_HOST=falkordb-master \ -e REPLICATION_ID=replica1 \ + -p 6379:6379 \ falkordb/falkordb ``` In this setup: - * The -e REPLICATION_MODE=replica flag sets the instance as a replica. - * The -e REPLICATION_MASTER_HOST=falkordb-master flag specifies the master instance's hostname or IP address. - * The -e REPLICATION_ID=replica1 assigns a unique ID to this replica. +* The -e REPLICATION_MODE=replica flag sets the instance as a replica. +* The -e REPLICATION_MASTER_HOST=falkordb-master flag specifies the master instance's hostname or IP address. +* The -e REPLICATION_ID=replica1 assigns a unique ID to this replica. You can add additional replicas by repeating the command with different container names and REPLICATION_IDs. @@ -94,25 +93,25 @@ You can add additional replicas by repeating the command with different containe To verify that your setup is working correctly: - * Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. +* Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. ```bash - docker stop falkordb - docker start falkordb +docker stop falkordb +docker start falkordb ``` - * Replication Check: Insert some data into the master instance and check if it is available in the replica. +* Replication Check: Insert some data into the master instance and check if it is available in the replica. ```bash - # Connect to the master - docker exec -it falkordb-master /bin/bash - falkordb-cli set key "Hello, FalkorDB!" - exit - - # Connect to the replica - docker exec -it falkordb-replica1 /bin/bash - falkordb-cli get key - # Output should be "Hello, FalkorDB!" +# Connect to the master +docker exec -it falkordb-master /bin/bash +falkordb-cli set key "Hello, FalkorDB!" +exit + +# Connect to the replica +docker exec -it falkordb-replica1 /bin/bash +falkordb-cli get key +# Output should be "Hello, FalkorDB!" ``` ## Conclusion From e81d3acea2296c5ab1cbe2048d71faa0457c8b47 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Sun, 18 Aug 2024 16:36:56 +0300 Subject: [PATCH 3/7] fix type --- .wordlist.txt | 2 ++ persistence_replication.md | 32 ++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.wordlist.txt b/.wordlist.txt index 16e44ae..64c6c87 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -125,6 +125,7 @@ enums epel expr exprList +failover falkordb fulltext geospatial @@ -132,6 +133,7 @@ godoc hasLabels haversin https +hostname hydre idx indegree diff --git a/persistence_replication.md b/persistence_replication.md index f859d34..4da95d9 100644 --- a/persistence_replication.md +++ b/persistence_replication.md @@ -61,7 +61,6 @@ docker run -d \ -p 6379:6379 \ falkordb/falkordb ``` - Here: The -e REPLICATION_MODE=master flag sets this instance as the master. @@ -96,8 +95,23 @@ To verify that your setup is working correctly: * Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. ```bash +redis-cli graph.query mygraph "CREATE (:Database {name:'falkordb'})" + docker stop falkordb docker start falkordb + +redis-cli graph.query mygraph "MATCH (n) return n" +# Output should be: +# 1) 1) "n" +# 2) 1) 1) 1) 1) "id" +# 2) (integer) 0 +# 2) 1) "labels" +# 2) 1) "Database" +# 3) 1) "properties" +# 2) 1) 1) "name" +# 2) "falkordb" +# 3) 1) "Cached execution: 1" +# 2) "Query internal execution time: 0.122645 milliseconds" ``` * Replication Check: Insert some data into the master instance and check if it is available in the replica. @@ -105,13 +119,23 @@ docker start falkordb ```bash # Connect to the master docker exec -it falkordb-master /bin/bash -falkordb-cli set key "Hello, FalkorDB!" +redis-cli graph.query mygraph "CREATE (:Database {name:'falkordb'})" exit # Connect to the replica docker exec -it falkordb-replica1 /bin/bash -falkordb-cli get key -# Output should be "Hello, FalkorDB!" +redis-cli graph.query mygraph "MATCH (n) return n" +# Output should be: +# 1) 1) "n" +# 2) 1) 1) 1) 1) "id" +# 2) (integer) 0 +# 2) 1) "labels" +# 2) 1) "Database" +# 3) 1) "properties" +# 2) 1) 1) "name" +# 2) "falkordb" +# 3) 1) "Cached execution: 1" +# 2) "Query internal execution time: 0.122645 milliseconds" ``` ## Conclusion From c5e997a506649f596f9861cc6e7462f745c4503d Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Mon, 19 Aug 2024 16:37:30 +0300 Subject: [PATCH 4/7] break page to a chapter --- operation/cluster.md | 130 ++++++++++++++++++ operation/index.md | 22 +++ operation/persistence.md | 77 +++++++++++ .../replication.md | 72 ++-------- 4 files changed, 241 insertions(+), 60 deletions(-) create mode 100644 operation/cluster.md create mode 100644 operation/index.md create mode 100644 operation/persistence.md rename persistence_replication.md => operation/replication.md (50%) diff --git a/operation/cluster.md b/operation/cluster.md new file mode 100644 index 0000000..31df292 --- /dev/null +++ b/operation/cluster.md @@ -0,0 +1,130 @@ +--- +title: "Cluster" +nav_order: 2 +description: "Configuring FalkorDB Docker for Cluster" +--- + +# Setting Up a FalkorDB Cluster + +Setting up a FalkorDB cluster enables you to distribute your data across multiple nodes, providing horizontal scalability and improved fault tolerance. This guide will walk you through the steps to configure a FalkorDB cluster using Docker. + +## Prerequisites + +Before you begin, ensure you have the following: + +* Docker installed on your machine. +* A working FalkorDB Docker image. You can pull it from Docker Hub. +* Basic knowledge of Docker networking and commands. + +## Step 1: Network Configuration + +First, create a Docker network to allow communication between the FalkorDB nodes. + +```bash +docker network create falkordb-cluster-network +``` + +This network will enable the containers to communicate with each other. + +## Step 2: Launching FalkorDB Nodes + +Next, you need to launch multiple FalkorDB instances that will form the cluster. For example, you can start three nodes: + +### 2.1 Start the First Node + +```bash +docker run -d \ + --name falkordb-node1 \ + --net falkordb-cluster-network \ + -e CLUSTER_MODE=enabled \ + -e CLUSTER_ID=node1 \ + falkordb/falkordb +``` + +### 2.2 Start the Second Node + +```bash +docker run -d \ + --name falkordb-node2 \ + --net falkordb-cluster-network \ + -e CLUSTER_MODE=enabled \ + -e CLUSTER_ID=node2 \ + falkordb/falkordb +``` + +### 2.3 Start the Third Node + +```bash +docker run -d \ + --name falkordb-node3 \ + --net falkordb-cluster-network \ + -e CLUSTER_MODE=enabled \ + -e CLUSTER_ID=node3 \ + falkordb/falkordb +``` + +In these commands: + +* The --net falkordb-cluster-network flag connects the container to the network created in Step 1. +* The -e CLUSTER_MODE=enabled flag enables clustering mode. +* The -e CLUSTER_ID flag assigns a unique identifier to each node. + +## Step 3: Configuring the Cluster + +Once all nodes are up, you need to connect them to form a cluster. Use the falkordb-cli tool inside one of the nodes to initiate the cluster setup. + +### 3.1 Connect to a Node + +```bash +docker exec -it falkordb-node1 /bin/bash +``` + +### 3.2 Initiate the Cluster + +Inside the container, use the following command to form the cluster: + +```bash +redis-cli cluster create node1 node2 node3 +``` + +This command will join node1, node2, and node3 into a cluster. + +### 3.3 Verify Cluster Status + +You can verify the status of the cluster with: + +```bash +redis-cli cluster status +``` + +This command will display the status of each node and their roles (master/replica). + +## Step 4: Scaling the Cluster + +You can scale the cluster by adding more nodes as needed. Simply launch additional FalkorDB instances and add them to the cluster using the falkordb-cli tool. + +For example, to add a new node: + +### 4.1 Start a New Node + +```bash +docker run -d \ + --name falkordb-node4 \ + --net falkordb-cluster-network \ + -e CLUSTER_MODE=enabled \ + -e CLUSTER_ID=node4 \ + falkordb/falkordb +``` + +### 4.2 Add the Node to the Cluster + +```bash +docker exec -it falkordb-node1 /bin/bash +redis-cli cluster add node4 +``` + +This will integrate node4 into the existing cluster. + +## Conclusion + +With your FalkorDB cluster set up, you now have a scalable, distributed environment that can handle increased loads and provide higher availability. \ No newline at end of file diff --git a/operation/index.md b/operation/index.md new file mode 100644 index 0000000..576a459 --- /dev/null +++ b/operation/index.md @@ -0,0 +1,22 @@ +--- +title: "Operations" +nav_order: 10 +description: "Configuring FalkorDB Docker" +--- + +# Operations + +The Operations chapter provides essential guides for configuring and managing FalkorDB in production environments. These guides cover critical aspects like data persistence, replication for high availability, and setting up clusters for horizontal scalability. +Table of Contents + +## 1. [Configuring Persistence](/operation/persistence) + +Learn how to set up FalkorDB with data persistence, ensuring that your data remains intact even after container restarts. + +## 2. [Configuring Replication](/operation/replication) + +Set up replication in FalkorDB to achieve high availability and data redundancy across multiple instances. + +## 3. [Setting Up a Cluster](/operation/cluster) + +Discover how to configure a FalkorDB cluster for horizontal scalability and improved fault tolerance, distributing your data across multiple nodes. \ No newline at end of file diff --git a/operation/persistence.md b/operation/persistence.md new file mode 100644 index 0000000..73d7fb2 --- /dev/null +++ b/operation/persistence.md @@ -0,0 +1,77 @@ +--- +title: "Persistence" +nav_order: 1 +description: "Configuring FalkorDB Docker for Persistence" +--- + +# Configuring FalkorDB Docker for Persistence + +FalkorDB supports advanced configurations to enable data persistence, ensuring that your data is safe and remains intact even after container restarts. This guide will walk you through setting up FalkorDB in Docker with persistence enabled. + +## Prerequisites + +Before you begin, ensure you have the following: + +* Docker installed on your machine. +* A working FalkorDB Docker image. You can pull it from Docker Hub. +* Basic knowledge of Docker commands and configurations. + +## Step 1: Setting Up Persistence + +Persistence in FalkorDB allows you to store your data on the host machine, ensuring that it is not lost when the container restarts. + +### 1.1 Create a Persistent Volume + +First, create a Docker volume to store the data: + +```bash +docker volume create falkordb_data +``` + +This volume will be used to store the database files. + +### 1.2 Start FalkorDB with the Persistent Volume + +You can now run FalkorDB with the volume attached: + +```bash +docker run -d --name falkordb -v falkordb_data:/data -p 6379:6379 falkordb/falkordb +``` + +In this configuration: + +The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. +FalkorDB will use this directory to store its data. + +## Step 2: Verifying the Setup + +To verify that your setup is working correctly: + +* Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. + +```bash +redis-cli graph.query mygraph "CREATE (:Database {name:'falkordb'})" + +docker stop falkordb +docker start falkordb + +redis-cli graph.query mygraph "MATCH (n) return n" +# Output should be: +# 1) 1) "n" +# 2) 1) 1) 1) 1) "id" +# 2) (integer) 0 +# 2) 1) "labels" +# 2) 1) "Database" +# 3) 1) "properties" +# 2) 1) 1) "name" +# 2) "falkordb" +# 3) 1) "Cached execution: 1" +# 2) "Query internal execution time: 0.122645 milliseconds" +``` + +## Conclusion + +With persistence configured, FalkorDB is now set up for reliable data storage that remains intact across container restarts. This setup ensures that your data is consistently saved, providing a stable and dependable environment for your applications. + +If you're interested in learning more about high availability and replication, be sure to check out the [replication](/operation/replication) chapter in the documentation. + diff --git a/persistence_replication.md b/operation/replication.md similarity index 50% rename from persistence_replication.md rename to operation/replication.md index 4da95d9..28f6c6a 100644 --- a/persistence_replication.md +++ b/operation/replication.md @@ -1,13 +1,12 @@ --- -title: "Persistence and Replication" -nav_order: 8 -description: "Configuring FalkorDB Docker for Persistence and Replication -" +title: "Replication" +nav_order: 2 +description: "Configuring FalkorDB Docker for Replication" --- -# Configuring FalkorDB Docker for Persistence and Replication +# Configuring FalkorDB Docker for Replication -FalkorDB supports advanced configurations to enable data persistence and replication, ensuring that your data is safe and available across different instances. This guide will walk you through setting up FalkorDB in Docker with persistence and replication enabled. +FalkorDB supports advanced configurations to enable replication, ensuring that your data is available and synchronized across multiple instances. This guide will walk you through setting up FalkorDB in Docker with replication enabled, providing high availability and data redundancy. ## Prerequisites @@ -17,38 +16,11 @@ Before you begin, ensure you have the following: * A working FalkorDB Docker image. You can pull it from Docker Hub. * Basic knowledge of Docker commands and configurations. -## Step 1: Setting Up Persistence - -Persistence in FalkorDB allows you to store your data on the host machine, ensuring that it is not lost when the container restarts. - -### 1.1 Create a Persistent Volume - -First, create a Docker volume to store the data: - -```bash -docker volume create falkordb_data -``` - -This volume will be used to store the database files. - -### 1.2 Start FalkorDB with the Persistent Volume - -You can now run FalkorDB with the volume attached: - -```bash -docker run -d --name falkordb -v falkordb_data:/data -p 6379:6379 falkordb/falkordb -``` - -In this configuration: - -The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. -FalkorDB will use this directory to store its data. - -## Step 2: Configuring Replication +## Step 1: Configuring Replication Replication ensures that your data is available across multiple FalkorDB instances. You can configure one instance as the master and others as replicas. -### 2.1 Setting Up the Master Instance +### 1.1 Setting Up the Master Instance Start the master FalkorDB instance: @@ -66,7 +38,7 @@ Here: The -e REPLICATION_MODE=master flag sets this instance as the master. The -e REPLICATION_ID=master1 assigns a unique ID to the master. -### 2.2 Configuring the Replica Instances +### 1.2 Configuring the Replica Instances Next, start the replica instances that will replicate data from the master: @@ -88,32 +60,10 @@ In this setup: You can add additional replicas by repeating the command with different container names and REPLICATION_IDs. -## Step 3: Verifying the Setup +## Step 2: Verifying the Setup To verify that your setup is working correctly: -* Persistence Check: Stop the FalkorDB container and start it again. The data should persist across restarts. - -```bash -redis-cli graph.query mygraph "CREATE (:Database {name:'falkordb'})" - -docker stop falkordb -docker start falkordb - -redis-cli graph.query mygraph "MATCH (n) return n" -# Output should be: -# 1) 1) "n" -# 2) 1) 1) 1) 1) "id" -# 2) (integer) 0 -# 2) 1) "labels" -# 2) 1) "Database" -# 3) 1) "properties" -# 2) 1) 1) "name" -# 2) "falkordb" -# 3) 1) "Cached execution: 1" -# 2) "Query internal execution time: 0.122645 milliseconds" -``` - * Replication Check: Insert some data into the master instance and check if it is available in the replica. ```bash @@ -140,4 +90,6 @@ redis-cli graph.query mygraph "MATCH (n) return n" ## Conclusion -With persistence and replication configured, FalkorDB is now set up for reliable data storage and high availability. You can scale this setup by adding more replicas or by implementing Redis Sentinel for automatic failover. \ No newline at end of file +With replication configured, FalkorDB is now set up for high availability and data redundancy, ensuring that your data is synchronized across multiple instances. This setup provides a robust and fault-tolerant environment for your applications. + +If you're interested in learning more about clustering and scaling out, be sure to check out the [Cluster](/operation/cluster) chapter in the documentation. \ No newline at end of file From e74c2c4e5dff9bb84973ed77c0c97ec484387f6a Mon Sep 17 00:00:00 2001 From: Dudi Zimberknopf Date: Wed, 21 Aug 2024 15:59:26 +0300 Subject: [PATCH 5/7] fix examples --- operation/cluster.md | 84 ++++++++++++++++++++++++---------------- operation/index.md | 4 +- operation/persistence.md | 2 +- operation/replication.md | 43 +++++++++++--------- 4 files changed, 79 insertions(+), 54 deletions(-) diff --git a/operation/cluster.md b/operation/cluster.md index 31df292..5651d39 100644 --- a/operation/cluster.md +++ b/operation/cluster.md @@ -6,7 +6,7 @@ description: "Configuring FalkorDB Docker for Cluster" # Setting Up a FalkorDB Cluster -Setting up a FalkorDB cluster enables you to distribute your data across multiple nodes, providing horizontal scalability and improved fault tolerance. This guide will walk you through the steps to configure a FalkorDB cluster using Docker. +Setting up a FalkorDB cluster enables you to distribute your data across multiple nodes, providing horizontal scalability and improved fault tolerance. This guide will walk you through the steps to configure a FalkorDB cluster with 3 masters and 1 replica for each, using Docker. ## Prerequisites @@ -28,55 +28,74 @@ This network will enable the containers to communicate with each other. ## Step 2: Launching FalkorDB Nodes -Next, you need to launch multiple FalkorDB instances that will form the cluster. For example, you can start three nodes: +Next, you need to launch multiple FalkorDB instances that will form the cluster. For example, you can start six nodes: -### 2.1 Start the First Node +### 2.1 Start the nodes ```bash docker run -d \ - --name falkordb-node1 \ - --net falkordb-cluster-network \ - -e CLUSTER_MODE=enabled \ - -e CLUSTER_ID=node1 \ + --name node1 \ + --network falkordb-cluster-network \ + -p 6379:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ falkordb/falkordb ``` -### 2.2 Start the Second Node +```bash +docker run -d \ + --name node2 \ + --network falkordb-cluster-network \ + -p 6380:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ + falkordb/falkordb +``` ```bash docker run -d \ - --name falkordb-node2 \ - --net falkordb-cluster-network \ - -e CLUSTER_MODE=enabled \ - -e CLUSTER_ID=node2 \ + --name node3 \ + --network falkordb-cluster-network \ + -p 6381:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ falkordb/falkordb ``` -### 2.3 Start the Third Node +```bash +docker run -d \ + --name node4 \ + --network falkordb-cluster-network \ + -p 6382:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ + falkordb/falkordb +``` ```bash docker run -d \ - --name falkordb-node3 \ - --net falkordb-cluster-network \ - -e CLUSTER_MODE=enabled \ - -e CLUSTER_ID=node3 \ + --name node5 \ + --network falkordb-cluster-network \ + -p 6383:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ falkordb/falkordb ``` -In these commands: +```bash +docker run -d \ + --name node6 \ + --network falkordb-cluster-network \ + -p 6384:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ + falkordb/falkordb +``` -* The --net falkordb-cluster-network flag connects the container to the network created in Step 1. -* The -e CLUSTER_MODE=enabled flag enables clustering mode. -* The -e CLUSTER_ID flag assigns a unique identifier to each node. +In this command, the --network falkordb-cluster-network flag connects the container to the network created in Step 1. ## Step 3: Configuring the Cluster -Once all nodes are up, you need to connect them to form a cluster. Use the falkordb-cli tool inside one of the nodes to initiate the cluster setup. +Once all nodes are up, you need to connect them to form a cluster. Use the redis-cli tool inside one of the nodes to initiate the cluster setup. ### 3.1 Connect to a Node ```bash -docker exec -it falkordb-node1 /bin/bash +docker exec -it node1 /bin/bash ``` ### 3.2 Initiate the Cluster @@ -84,7 +103,7 @@ docker exec -it falkordb-node1 /bin/bash Inside the container, use the following command to form the cluster: ```bash -redis-cli cluster create node1 node2 node3 +redis-cli --cluster create node1:6379 node2:6379 node3:6379 node4:6379 node5:6379 node6:6379 --cluster-replicas 1 ``` This command will join node1, node2, and node3 into a cluster. @@ -94,9 +113,8 @@ This command will join node1, node2, and node3 into a cluster. You can verify the status of the cluster with: ```bash -redis-cli cluster status +redis-cli --cluster check node1:6379 ``` - This command will display the status of each node and their roles (master/replica). ## Step 4: Scaling the Cluster @@ -109,21 +127,21 @@ For example, to add a new node: ```bash docker run -d \ - --name falkordb-node4 \ - --net falkordb-cluster-network \ - -e CLUSTER_MODE=enabled \ - -e CLUSTER_ID=node4 \ + --name node7 \ + --network falkordb-cluster-network \ + -p 6385:6379 \ + -e 'FALKORDB_ARGS=--cluster-enabled yes' \ falkordb/falkordb ``` ### 4.2 Add the Node to the Cluster ```bash -docker exec -it falkordb-node1 /bin/bash -redis-cli cluster add node4 +docker exec -it node1 /bin/bash +redis-cli --cluster add-node node7:6379 node1:6379 ``` -This will integrate node4 into the existing cluster. +This will add node7 into the existing cluster. ## Conclusion diff --git a/operation/index.md b/operation/index.md index 576a459..1acd486 100644 --- a/operation/index.md +++ b/operation/index.md @@ -11,11 +11,11 @@ Table of Contents ## 1. [Configuring Persistence](/operation/persistence) -Learn how to set up FalkorDB with data persistence, ensuring that your data remains intact even after container restarts. +Learn how to set up FalkorDB with data persistence, ensuring that your data remains intact even after server restarts. ## 2. [Configuring Replication](/operation/replication) -Set up replication in FalkorDB to achieve high availability and data redundancy across multiple instances. +Set up replication in FalkorDB to achieve high availability and data redundancy across multiple nodes. ## 3. [Setting Up a Cluster](/operation/cluster) diff --git a/operation/persistence.md b/operation/persistence.md index 73d7fb2..9fc842e 100644 --- a/operation/persistence.md +++ b/operation/persistence.md @@ -41,7 +41,7 @@ docker run -d --name falkordb -v falkordb_data:/data -p 6379:6379 falkordb/falko In this configuration: The -v falkordb_data:/data flag mounts the volume to the /data directory inside the container. -FalkorDB will use this directory to store its data. +FalkorDB will use the /data directory by default. ## Step 2: Verifying the Setup diff --git a/operation/replication.md b/operation/replication.md index 28f6c6a..63ca72d 100644 --- a/operation/replication.md +++ b/operation/replication.md @@ -19,8 +19,17 @@ Before you begin, ensure you have the following: ## Step 1: Configuring Replication Replication ensures that your data is available across multiple FalkorDB instances. You can configure one instance as the master and others as replicas. +For that to work with Docker, we need to first set up a network. -### 1.1 Setting Up the Master Instance +### 1.1 Creating a Network + +First, create a Docker network to allow communication between the FalkorDB nodes. + +```bash +docker network create falkordb-network +``` + +### 1.1 Setting up the Master Instance Start the master FalkorDB instance: @@ -28,37 +37,35 @@ Start the master FalkorDB instance: docker run -d \ --name falkordb-master \ -v falkordb_data:/data \ - -e REPLICATION_MODE=master \ - -e REPLICATION_ID=master1 \ -p 6379:6379 \ + --network falkordb-network \ falkordb/falkordb ``` -Here: -The -e REPLICATION_MODE=master flag sets this instance as the master. -The -e REPLICATION_ID=master1 assigns a unique ID to the master. +This instance will be created in the Standalone mode, as master. -### 1.2 Configuring the Replica Instances +### 1.2 Setting up the Replica Instance -Next, start the replica instances that will replicate data from the master: +Next, start the replica instance: ```bash docker run -d \ --name falkordb-replica1 \ - -e REPLICATION_MODE=replica \ - -e REPLICATION_MASTER_HOST=falkordb-master \ - -e REPLICATION_ID=replica1 \ - -p 6379:6379 \ + -p 6380:6379 \ + --network falkordb-network \ falkordb/falkordb ``` -In this setup: +### 1.3 Configuring Replication + +Connect to the replica instance and configure it to replicate data from the master: -* The -e REPLICATION_MODE=replica flag sets the instance as a replica. -* The -e REPLICATION_MASTER_HOST=falkordb-master flag specifies the master instance's hostname or IP address. -* The -e REPLICATION_ID=replica1 assigns a unique ID to this replica. +```bash +docker exec -it falkordb-replica1 /bin/bash +redis-cli replicaof falkordb-master 6379 +``` -You can add additional replicas by repeating the command with different container names and REPLICATION_IDs. +This command tells the replica to replicate data from the master instance. ## Step 2: Verifying the Setup @@ -74,7 +81,7 @@ exit # Connect to the replica docker exec -it falkordb-replica1 /bin/bash -redis-cli graph.query mygraph "MATCH (n) return n" +redis-cli graph.ro_query mygraph "MATCH (n) return n" # Output should be: # 1) 1) "n" # 2) 1) 1) 1) 1) "id" From 1f793fbb3743e71b0da80e3dc77842b0ba1e4f3e Mon Sep 17 00:00:00 2001 From: Dudi Zimberknopf Date: Wed, 21 Aug 2024 16:08:12 +0300 Subject: [PATCH 6/7] add words --- .wordlist.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.wordlist.txt b/.wordlist.txt index 64c6c87..b2e4ec6 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -262,3 +262,5 @@ Rossi localhost BGSAVE RDB +scalable +scalability \ No newline at end of file From 3b6628e0be73b8b695eb3c9ea12bf271b619387f Mon Sep 17 00:00:00 2001 From: Dudi Zimberknopf Date: Thu, 22 Aug 2024 10:15:43 +0300 Subject: [PATCH 7/7] fix order --- operation/cluster.md | 3 ++- operation/persistence.md | 1 + operation/replication.md | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/operation/cluster.md b/operation/cluster.md index 5651d39..6d5e80e 100644 --- a/operation/cluster.md +++ b/operation/cluster.md @@ -1,7 +1,8 @@ --- title: "Cluster" -nav_order: 2 +nav_order: 3 description: "Configuring FalkorDB Docker for Cluster" +parent: "Operations" --- # Setting Up a FalkorDB Cluster diff --git a/operation/persistence.md b/operation/persistence.md index 9fc842e..5f2947e 100644 --- a/operation/persistence.md +++ b/operation/persistence.md @@ -2,6 +2,7 @@ title: "Persistence" nav_order: 1 description: "Configuring FalkorDB Docker for Persistence" +parent: "Operations" --- # Configuring FalkorDB Docker for Persistence diff --git a/operation/replication.md b/operation/replication.md index 63ca72d..1c9f2e2 100644 --- a/operation/replication.md +++ b/operation/replication.md @@ -2,6 +2,7 @@ title: "Replication" nav_order: 2 description: "Configuring FalkorDB Docker for Replication" +parent: "Operations" --- # Configuring FalkorDB Docker for Replication