Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 42 additions & 19 deletions docs/bootstrap.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
# Bootstrap the first node

After you [configure all PXC nodes](configure-nodes.md#configure-nodes-for-write-set-replication), initialize the cluster by
bootstrapping the first node. The initial node must contain all the data that you want to be replicated to other nodes.
bootstrapping the first node. This node must contain all the data you want to replicate to other nodes.

Bootstrapping implies starting the first node without any known cluster
addresses: if the `wsrep_cluster_address` variable is empty, Percona XtraDB Cluster assumes that this is the first node and initializes the cluster.
Start the first node without any known cluster
addresses: if the `wsrep_cluster_address` variable is empty, Percona XtraDB Cluster treats node as the first node and initializes the cluster.

Instead of changing the configuration, start the first node, `[root@pxc1 ~]#`, using the following command:

```shell
systemctl start mysql@bootstrap.service
systemctl start mysql@bootstrap
```

When you start the node using the previous command,
it runs in bootstrap mode with `wsrep_cluster_address=gcomm://`.
This tells the node to initialize the cluster
with `wsrep_cluster_conf_id` variable set to `1`.
After you [add other nodes](add-node.md#add-nodes-to-cluster) to the cluster,
you can then restart this node as normal,
and it will use standard configuration again.
When you start the node using this command,
the node runs in bootstrap mode with `wsrep_cluster_address=gcomm://`.
Bootstrap mode initializes the cluster and sets the `wsrep_cluster_conf_id` variable to `1`.

After you [add other nodes](add-node.md) to the cluster,
you can then restart the first node as normal. Then node uses the standard configuration again.

!!! note

A service started with `mysql@bootstrap` must be stopped using the same command. For example, the `systemctl stop mysql` command does not stop an instance started with the `mysql@bootstrap` command.
Stop a node started with `mysql@bootstrap` by running `systemctl stop mysql@bootstrap`. The `systemctl stop mysql` command does not stop an instance started with `mysql@bootstrap`.

To make sure that the cluster, `mysql@pxc1>`, has been initialized, run the following:
To status of the first node, `mysql@pxc1>`, run the following:

```sql
SHOW STATUS LIKE 'wsrep%';
```

The output shows that the cluster size is one node,
it is the primary component, the node is in the `Synced` state,
it is fully connected and ready for write-set replication.

??? example "Expected output"

```{.text .no-copy}
Expand All @@ -54,8 +49,36 @@ it is fully connected and ready for write-set replication.
40 rows in set (0.01 sec)
```


The output confirms that the first node initialized the cluster:

* Cluster size: one node

* Cluster status: primary component

* Node state: Synced

* Connection status: fully connected and ready for write-set replication

## Generate and copy SSL certificates

Generate the SSL certificates on this node before you add other nodes to the cluster. Use identical key and certificate files on every node. Store the certificates in `/etc/`, outside the data directory.

1. Generate the SSL certificates, `[root@pxc1 ~]#`:

```shell
openssl req -newkey rsa:2048 -nodes -keyout /etc/server-key.pem \
-x509 -days 365 -out /etc/server-cert.pem
```

2. Copy the certificates to the nodes you plan to add. For example:

```shell
scp /etc/server-key.pem pxc2:/etc/
scp /etc/server-cert.pem pxc2:/etc/
scp /etc/server-key.pem pxc3:/etc/
scp /etc/server-cert.pem pxc3:/etc/
```

## Next steps

After initializing the cluster, you can [add other nodes](add-node.md#add-nodes-to-cluster).
After initializing the cluster, you can [add other nodes](add-node.md).
Loading