Skip to main content

Getting Started

In this tutorial, we will set up a highly durable WeSQL cluster on AWS, consisting of three nodes:

  • One data node: This node will provide MySQL read and write services.

  • Two logger nodes: These nodes do not provide data services, but function as logger nodes within the Raft consensus algorithm. Their primary role is to facilitate the replication of binlogs.

Even if the data node fails, the logger nodes will continue synchronizing the binlogs to object storage (e.g., Amazon S3), thereby ensuring data consistency. Since the logger nodes handle only logging, they require fewer resources compared to the data node. A logger node can run on a lightweight instance, such as a virtual machine or a Kubernetes Pod with just 1 CPU.

Prerequisites

  1. Create an Amazon S3 Bucket First, you need to create a bucket in AWS S3 to use as object storage for cluster data. Refer to the Amazon S3 Create Bucket Guide

Use the following command to create a bucket named wesql-cluster-1 in the cn-northwest-1 region:

 aws s3api create-bucket --bucket wesql-cluster-test --region cn-northwest-1 --create-bucket-configuration LocationConstraint=cn-northwest-1

Verify that the newly created bucket is accessible by listing the contents of the bucket:

 aws s3 ls s3://wesql-cluster-test --region cn-northwest-1
  1. Set Up Access Keys for S3

Make sure you have created access keys for your AWS account to interact with S3. For more details on how to create access keys, refer to Manage IAM User Access key

On each of your server nodes (for example, 192.168.0.2, 192.168.0.3, 192.168.0.4), set the environment variables for your S3 access keys:

export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_access_key

Ensure that these keys have the appropriate permissions to read and write to the S3 bucket.