Skip to main content

Deploying a Standalone Databend

Deploying a Standalone Databend

Databend works with both self-hosted and cloud object storage solutions. This topic explains how to deploy Databend with your object storage. For a list of supported object storage solutions, see Understanding Deployment Modes.

note

It is not recommended to deploy Databend on top of MinIO for production environments or performance testing.

Setting up Your Object Storage

Before deploying Databend, make sure you have successfully set up your object storage environment in the cloud, and the following tasks have been completed:

  • Create a bucket or container named databend.
  • Get the endpoint URL for connecting to the bucket or container you created.
  • Get the Access Key ID and Secret Access Key for your account.

For information about how to manage buckets and Access Keys for your cloud object storage, refer to the user manual from the solution provider. Here are some useful links you may need:

Downloading Databend

a. Create a folder named databend in the directory /usr/local.

b. Download and extract the latest Databend release for your platform from GitHub Release:

curl -LJO https://github.com/datafuselabs/databend/releases/download/${version}/databend-${version}-x86_64-unknown-linux-musl.tar.gz
tar xzvf databend-${version}-x86_64-unknown-linux-musl.tar.gz

c. Move the extracted folders bin, configs, and scripts to the folder /usr/local/databend.

Deploying a Meta Node

a. Open the file databend-meta.toml in the folder /usr/local/databend/configs, and replace 127.0.0.1 with 0.0.0.0 within the whole file.

b. Open a terminal window and navigate to the folder /usr/local/databend/bin.

c. Run the following command to start the Meta node:

./databend-meta -c ../configs/databend-meta.toml > meta.log 2>&1 &

d. Run the following command to check if the Meta node was started successfully:

curl -I  http://127.0.0.1:28101/v1/health

Deploying a Query Node

a. Open the file databend-query.toml in the folder /usr/local/databend/configs, and replace 127.0.0.1 with 0.0.0.0 within the whole file.

b. In the file databend-query.toml, set the parameter type in the [storage] block and configure the access credentials and endpoint URL for connecting to your object storage.

To configure your storage settings, please comment out the [storage.fs] section by adding '#' at the beginning of each line, and then uncomment the appropriate section for your object storage provider by removing the '#' symbol, and fill in the necessary values. If your desired storage provider is not listed, you can copy and paste the corresponding template below to the file and configure it accordingly.

[storage]
# s3
type = "s3"

[storage.s3]
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html
bucket = "databend"
endpoint_url = "https://s3.amazonaws.com"

# How to get access_key_id and secret_access_key:
# https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html
access_key_id = "<your-key-id>"
secret_access_key = "<your-access-key>"

c. Configure an admin user in the [query.users] section. For more information, see Configuring Admin Users.

d. Open a terminal window and navigate to the folder /usr/local/databend/bin.

e. Run the following command to start the Query node:

./databend-query -c ../configs/databend-query.toml > query.log 2>&1 &

f. Run the following command to check if the Query node was started successfully:

curl -I  http://127.0.0.1:8080/v1/health

Verifying Deployment

In this section, we will run some queries against Databend to verify the deployment.

a. Download and install a MySQL client on your local machine.

b. Create a connection to 127.0.0.1 from your SQL client. In the connection, set the port to 3307, and set the username to root.

tip

Create new users. The root user only works when you access Databend from localhost. You will need to create new users and grant proper privileges first to connect to Databend remotely. For example,

-- Create a user named "eric" with the password "databend"
CREATE USER eric IDENTIFIED BY 'databend';

-- Grant the ALL privilege on all existing tables in the default database to the user eric:
GRANT ALL ON default.* TO eric;

For more information about creating new users, see CREATE USER.

c. Run the following commands and check if the query is successful:

CREATE TABLE t1(a int);

INSERT INTO t1 VALUES(1), (2);

SELECT * FROM t1;

Starting and Stopping Databend

Each time you start and stop Databend, simply run the scripts in the folder /usr/local/databend/scripts:

# Start Databend
./scripts/start.sh

# Stop Databend
./scripts/stop.sh
tip

In case you encounter the subsequent error messages while attempting to start Databend:

==> query.log <==
: No getcpu support: percpu_arena:percpu
: option background_thread currently supports pthread only
Databend Query start failure, cause: Code: 1104, Text = failed to create appender: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }.

Run the following commands and try starting Databend again:

sudo mkdir /var/log/databend
sudo mkdir /var/lib/databend
sudo chown -R $USER /var/log/databend
sudo chown -R $USER /var/lib/databend