feat(bot): ✨ Migrate from Citus to PostgreSQL.
This commit is contained in:
@@ -167,47 +167,14 @@ kubectl apply -f k8s/secrets.yml
|
||||
If you see a ConfigMap and a Secret being created, that means you've successfully applied the
|
||||
changes.
|
||||
|
||||
#### Setting Up Redis
|
||||
#### Setting Up Redis and PostgreSQL
|
||||
|
||||
Now, you can initialize Redis. This step is pretty straightforward and you can forget about it
|
||||
later.
|
||||
|
||||
```sh
|
||||
kubectl apply -f k8s/redis.yml
|
||||
```
|
||||
|
||||
#### Setting Up Citus Database
|
||||
|
||||
This step requires some updates in the `k8s/citus.yml` file. Open the file and make sure that the
|
||||
default amount of replicas fits your needs. At least one is needed.
|
||||
|
||||
```sh
|
||||
kubectl apply -f k8s/citus.yml
|
||||
```
|
||||
|
||||
Once all the nodes are up and running, you have to connect them. The node `citus-0` is always used
|
||||
as the coordinator node. Run the following command to set the coordinator host:
|
||||
|
||||
```sh
|
||||
kubectl exec citus-0 -- psql -U payphone payphone -c "SELECT citus_set_coordinator_host('citus-0.citus-headless.default.svc.cluster.local', 5432);"
|
||||
```
|
||||
|
||||
Once that command was run, you need to add the rest of the nodes to the cluster. To do that, run
|
||||
the following command replacing `<node-index>` with the index of the node you're adding, once per
|
||||
node.
|
||||
|
||||
```sh
|
||||
kubectl exec citus-0 -- psql -U payphone payphone -c "SELECT * from citus_add_node('citus-<node-index>.citus-headless.default.svc.cluster.local', 5432);"
|
||||
```
|
||||
|
||||
For example, if you had 3 replicas in total, you'd run the command 2 times, once for node 1 and
|
||||
once for node 2 (node 0 is the coordinator, so you don't have to add it).
|
||||
|
||||
As an optional step, you can check that the nodes were successfully connected running the following
|
||||
command, which will show all the nodes connected:
|
||||
|
||||
```sh
|
||||
kubectl exec citus-0 -- psql -U payphone payphone -c "SELECT * FROM citus_get_active_worker_nodes();"
|
||||
kubectl apply -f k8s/psql.yml
|
||||
```
|
||||
|
||||
#### Setting Up Payphone
|
||||
|
||||
Reference in New Issue
Block a user