Skip to content

Commit

Permalink
PXC-4084 Update installation examples (#138)
Browse files Browse the repository at this point in the history
modified:   docs/high-availability.md
  • Loading branch information
patrickbirch authored Mar 14, 2024
1 parent c2864d4 commit 9d1a136
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 181 deletions.
28 changes: 8 additions & 20 deletions docs/apt.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ We gather [Telemetry data] in the Percona packages and Docker images.

* You need to have root access on the node where you will be installing Percona XtraDB Cluster (either logged in as a user with root privileges or be able to run commands with sudo).

* Make sure that the following ports are not blocked by firewall or used by other software. Percona XtraDB Cluster requires them for communication.

* 3306


* 4444


* 4567


* 4568

!!! admonition "See also"

Expand All @@ -36,43 +24,43 @@ We gather [Telemetry data] in the Percona packages and Docker images.

1. Update the sytem:

```shell
```{.bash data-prompt="$"}
sudo apt update
```

2. Install the necessary packages:

```shell
```{.bash data-prompt="$"}
sudo apt install -y wget gnupg2 lsb-release curl
```

3. Download the repository package

```shell
```{.bash data-prompt="$"}
wget https://repo.percona.com/apt/percona-release_latest.generic_all.deb
```

4. Install the package with `dpkg`:

```shell
```{.bash data-prompt="$"}
sudo dpkg -i percona-release_latest.generic_all.deb
```

5. Refresh the local cache to update the package information:

```shell
```{.bash data-prompt="$"}
sudo apt update
```

6. Enable the `release` repository for *Percona XtraDB Cluster*:

```shell
```{.bash data-prompt="$"}
sudo percona-release setup pxc80
```

7. Install the cluster:

```shell
```{.bash data-prompt="$"}
sudo apt install -y percona-xtradb-cluster
```

Expand Down Expand Up @@ -114,4 +102,4 @@ During the installation, you are requested to provide a password for the `root`
After you install Percona XtraDB Cluster and stop the `mysql` service,
configure the node according to the procedure described in [Configuring Nodes for Write-Set Replication](configure-nodes.md#configure).

[Telemetry data]: telemetry.md
[Telemetry data]: telemetry.md
12 changes: 6 additions & 6 deletions docs/certification.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ The following example shows what happens in a common situation.
`act_id` is incremented and assigned only for totally ordered actions,
and only in primary state (skip messages while in state exchange).

```shell
rcvd->id = ++group->act_id_;
```{.bash data-prompt="$"}
$ rcvd->id = ++group->act_id_;
```

!!! note
Expand All @@ -100,8 +100,8 @@ The following happens if two nodes get ready with their packet at same time:

2. The following example shows what happens if two nodes modify same set of rows. Nodes are in sync until this point:

```shell
create -> insert (1,2,3,4)
```{.bash data-prompt="$"}
$ create -> insert (1,2,3,4)
```

* Node 1: `update i = i + 10;`
Expand Down Expand Up @@ -165,8 +165,8 @@ and the local conflicting transaction will be rolled back.
The following example shows what happens
if one of the nodes has local changes that are not synced with the group:

```sql
create (id primary key) -> insert (1), (2), (3), (4);
```{.bash data-prompt="mysql>"}
mysql> create (id primary key) -> insert (1), (2), (3), (4);
```

??? example "Expected output"
Expand Down
104 changes: 52 additions & 52 deletions docs/configure-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,86 +11,86 @@ In this section, we will demonstrate how to configure a three node cluster:

1. Stop the Percona XtraDB Cluster server. After the installation completes the server is not started. You need this step if you have started the server manually.

```{.bash data-prompt="$"}
$ sudo service mysql stop
```
```{.bash data-prompt="$"}
$ sudo service mysql stop
```

2. Edit the configuration file of the first node to provide the cluster settings.

*If you use Debian or Ubuntu*, edit `/etc/mysql/mysql.conf.d/mysqld.cnf`:
*If you use Debian or Ubuntu*, edit `/etc/mysql/mysql.conf.d/mysqld.cnf`:

```shell
wsrep_provider=/usr/lib/galera4/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://192.168.70.61,192.168.70.62,192.168.70.63
```
```{.bash data-prompt="$"}
wsrep_provider=/usr/lib/galera4/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://192.168.70.61,192.168.70.62,192.168.70.63
```

*If you use Red Hat or CentOS*, edit `/etc/my.cnf`. Note that on these systems you set
the wsrep_provider option to a different value:
*If you use Red Hat or CentOS*, edit `/etc/my.cnf`. Note that on these systems you set
the wsrep_provider option to a different value:

```shell
wsrep_provider=/usr/lib64/galera4/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://192.168.70.61,192.168.70.62,192.168.70.63
```
```{.bash data-prompt="$"}
wsrep_provider=/usr/lib64/galera4/libgalera_smm.so
wsrep_cluster_name=pxc-cluster
wsrep_cluster_address=gcomm://192.168.70.61,192.168.70.62,192.168.70.63
```

3. Configure *node 1*.

```shell
wsrep_node_name=pxc1
wsrep_node_address=192.168.70.61
pxc_strict_mode=ENFORCING
```
```{.bash data-prompt="$"}
wsrep_node_name=pxc1
wsrep_node_address=192.168.70.61
pxc_strict_mode=ENFORCING
```

4. Set up *node 2* and *node 3* in the same way: Stop the server and update the configuration file applicable to your system. All settings are the same except for [`wsrep_node_name`](wsrep-system-index.md#wsrep_node_name) and [`wsrep_node_address`](wsrep-system-index.md#wsrep_node_address).

For node 2
For node 2

wsrep_node_name=pxc2
wsrep_node_address=192.168.70.62
wsrep_node_name=pxc2
wsrep_node_address=192.168.70.62

For node 3
For node 3

wsrep_node_name=pxc3
wsrep_node_address=192.168.70.63
wsrep_node_name=pxc3
wsrep_node_address=192.168.70.63

5. Set up the traffic encryption settings. Each node of the cluster must use the same SSL certificates.

```shell
[mysqld]
wsrep_provider_options=”socket.ssl_key=server-key.pem;socket.ssl_cert=server-cert.pem;socket.ssl_ca=ca.pem”
```{.bash data-prompt="$"}
[mysqld]
wsrep_provider_options=”socket.ssl_key=server-key.pem;socket.ssl_cert=server-cert.pem;socket.ssl_ca=ca.pem”

[sst]
encrypt=4
ssl-key=server-key.pem
ssl-ca=ca.pem
ssl-cert=server-cert.pem
```
[sst]
encrypt=4
ssl-key=server-key.pem
ssl-ca=ca.pem
ssl-cert=server-cert.pem
```

!!! important

In Percona XtraDB Cluster 8.0, the [Encrypting Replication Traffic](encrypt-traffic.md#encrypt-replication-traffic) is
enabled by default (via the `pxc-encrypt-cluster-traffic` variable).
In Percona XtraDB Cluster 8.0, the [Encrypting Replication Traffic](encrypt-traffic.md#encrypt-replication-traffic) is
enabled by default (via the `pxc-encrypt-cluster-traffic` variable).

The replication traffic encryption cannot be enabled on a running cluster. If
it was disabled before the cluster was bootstrapped, the cluster must to
stopped. Then set up the encryption, and bootstrap (see [`Bootstrapping the First Node`](bootstrap.md#bootstrap))
again.
The replication traffic encryption cannot be enabled on a running cluster. If
it was disabled before the cluster was bootstrapped, the cluster must to
stopped. Then set up the encryption, and bootstrap (see [`Bootstrapping the First Node`](bootstrap.md#bootstrap))
again.

!!! admonition "See also"
!!! admonition "See also"

More information about the security settings in Percona XtraDB Cluster
* [`Security Basics`](security-index.md#security)
* [`Encrypting PXC Traffic`](encrypt-traffic.md#encrypt-traffic)
* [`SSL Automatic Configuration`](encrypt-traffic.md#ssl-auto-conf)
More information about the security settings in Percona XtraDB Cluster
* [`Security Basics`](security-index.md#security)
* [`Encrypting PXC Traffic`](encrypt-traffic.md#encrypt-traffic)
* [`SSL Automatic Configuration`](encrypt-traffic.md#ssl-auto-conf)


## Template of the configuration file

Here is an example of a full configuration file installed on CentOS to
`/etc/my.cnf`.

```text
```{.text .no-copy}
# Template my.cnf for PXC
# Edit to your requirements.
[client]
Expand Down Expand Up @@ -159,10 +159,10 @@ the joining node can use other addresses.

!!! note

No addresses are required for the initial node in the cluster.
However, it is recommended to specify them
and [properly bootstrap the first node](bootstrap.md#bootstrap).
This will ensure that the node is able to rejoin the cluster if it goes down in the future.
No addresses are required for the initial node in the cluster.
However, it is recommended to specify them
and [properly bootstrap the first node](bootstrap.md#bootstrap).
This will ensure that the node is able to rejoin the cluster if it goes down in the future.

[`wsrep_node_name`](wsrep-system-index.md#wsrep_node_name)

Expand Down
18 changes: 9 additions & 9 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ file in the new directory:

4. Create a Docker network:

```shell
docker network create pxc-network
```{.bash data-prompt="$"}
$ docker network create pxc-network
```

5. Bootstrap the cluster (create the first node):

```shell
docker run -d \
```{.bash data-prompt="$"}
$ docker run -d \
-e MYSQL_ROOT_PASSWORD=test1234# \
-e CLUSTER_NAME=pxc-cluster1 \
--name=pxc-node1 \
Expand All @@ -78,8 +78,8 @@ file in the new directory:

6. Join the second node:

```shell
docker run -d \
```{.bash data-prompt="$"}
$ docker run -d \
-e MYSQL_ROOT_PASSWORD=test1234# \
-e CLUSTER_NAME=pxc-cluster1 \
-e CLUSTER_JOIN=pxc-node1 \
Expand All @@ -92,8 +92,8 @@ file in the new directory:

7. Join the third node:

```shell
docker run -d \
```{.bash data-prompt="$"}
$ docker run -d \
-e MYSQL_ROOT_PASSWORD=test1234# \
-e CLUSTER_NAME=pxc-cluster1 \
-e CLUSTER_JOIN=pxc-node1 \
Expand Down Expand Up @@ -155,4 +155,4 @@ To verify the cluster is available, do the following:
59 rows in set (0.02 sec)
```

[Telemetry data]: telemetry.md
[Telemetry data]: telemetry.md
28 changes: 14 additions & 14 deletions docs/encrypt-traffic.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ should use the same key and certificate files on all nodes.
Specify the following settings in the `my.cnf` configuration file
for each node:

```text
```{.text .no-copy}
[mysqld]
ssl-ca=/etc/mysql/certs/ca.pem
ssl-cert=/etc/mysql/certs/server-cert.pem
Expand Down Expand Up @@ -85,7 +85,7 @@ settings: [encrypt](xtrabackup-sst.md#encrypt), ssl_key, ssl-ca, ssl-cert.

Setting `pxc-encrypt-cluster-traffic=ON` has the effect of applying the following settings in the `my.cnf` configuration file:

```text
```{.text no-copy}
[mysqld]
wsrep_provider_options=”socket.ssl_key=server-key.pem;socket.ssl_cert=server-cert.pem;socket.ssl_ca=ca.pem”
Expand Down Expand Up @@ -175,7 +175,7 @@ For more information, see [State snapshot transfer](state-snapshot-transfer.md#s

If `keyring_file` plugin is used, then SST encryption is mandatory: when copying encrypted data via SST, the keyring must be sent over with the files for decryption. In this case following options are to be set in `my.cnf` on all nodes:

```text
```{.text .no-copy}
early-plugin-load=keyring_file.so
keyring-file-data=/path/to/keyring/file
```
Expand All @@ -199,7 +199,7 @@ Encryption mode for this method is selected using the [`encrypt`](xtrabackup-sst
specify the location of the keys and certificate files
in the each node’s configuration under `[sst]`:

```text
```{.text .no-copy}
[sst]
encrypt=4
ssl-ca=/etc/mysql/certs/ca.pem
Expand All @@ -214,8 +214,8 @@ Encryption mode for this method is selected using the [`encrypt`](xtrabackup-sst
If a `dhparams.pem` file of required length is not found during SST in the data directory, it is generated with 2048 bits, which can take several minutes.
To avoid this delay, create the `dhparams.pem` file manually and place it in the data directory before joining the node to the cluster:

```shell
openssl dhparam -out /path/to/datadir/dhparams.pem 2048
```{.bash data-prompt="$"}
$ openssl dhparam -out /path/to/datadir/dhparams.pem 2048
```

For more information, see [this blog post](https://www.percona.com/blog/2017/04/23/percona-xtradb-cluster-dh-key-too-small-error-during-an-sst-using-ssl/).
Expand Down Expand Up @@ -251,8 +251,8 @@ using the following [wsrep provider options](wsrep-provider-index.md#wsrep-provi

To set these options, use the [`wsrep_provider_options`](wsrep-system-index.md#wsrep_provider_options) variable in the configuration file:

```shell
wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/ca.pem;socket.ssl_cert=/etc/mysql/certs/server-cert.pem;socket.ssl_key=/etc/mysql/certs/server-key.pem"
```{.bash data-prompt="$"}
$ wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/ca.pem;socket.ssl_cert=/etc/mysql/certs/server-cert.pem;socket.ssl_key=/etc/mysql/certs/server-key.pem"
```

!!! note
Expand Down Expand Up @@ -439,21 +439,21 @@ used for securing replication traffic when there are two nodes in the cluster.
For example, you can merge contents of `old-ca.pem`
and `new-ca.pem` into `upgrade-ca.pem` as follows:

```shell
cat old-ca.pem > upgrade-ca.pem && \
```{.bash data-prompt="$"}
$ cat old-ca.pem > upgrade-ca.pem && \
cat new-ca.pem >> upgrade-ca.pem
```

Set the [`wsrep_provider_options`](wsrep-system-index.md#wsrep_provider_options) variable as follows:

```shell
wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/upgrade-ca.pem;socket.ssl_cert=/etc/mysql/certs/old-cert.pem;socket.ssl_key=/etc/mysql/certs/old-key.pem"
```{.bash data-prompt="$"}
$ wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/upgrade-ca.pem;socket.ssl_cert=/etc/mysql/certs/old-cert.pem;socket.ssl_key=/etc/mysql/certs/old-key.pem"
```

2. Restart the second node with the [`socket.ssl_ca`](wsrep-provider-index.md#socket.ssl_ca), [`socket.ssl_cert`](wsrep-provider-index.md#socket.ssl_cert), and [`socket.ssl_key`](wsrep-provider-index.md#socket.ssl_cert) options set to the corresponding new certificate files.

```shell
wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/new-ca.pem;socket.ssl_cert=/etc/mysql/certs/new-cert.pem;socket.ssl_key=/etc/mysql/certs/new-key.pem"
```{.bash data-prompt="$"}
$ wsrep_provider_options="socket.ssl=yes;socket.ssl_ca=/etc/mysql/certs/new-ca.pem;socket.ssl_cert=/etc/mysql/certs/new-cert.pem;socket.ssl_key=/etc/mysql/certs/new-key.pem"
```

3. Restart the first node with the new certificate files, as in the previous step.
Expand Down
Loading

0 comments on commit 9d1a136

Please sign in to comment.