---

slug: /deploy-by-systemd
---

# Deploy seekdb by using yum install

This topic describes how to deploy seekdb by using yum install.

## Prerequisites

Before performing the operations in this topic, you need to confirm the following information:

* Your environment is an RPM platform system. The currently verified supported systems are as follows:
  
  * Anolis OS 8.X (Linux kernel 4.19 or later)
  
  * Anolis OS 23.X (Linux kernel 6.6 or later)

  * CentOS Linux 7.X, 9.X (Linux kernel 4.19 or later)

  * Debian 11, 12, and 13 (Linux kernel 4.19 or later)

  * openEuler 22.03 and 24.03 (Linux kernel 5.10.0 or later)

  * Ubuntu 20.04, 22.04, and 24.04 (Linux kernel 4.19 or later)

* The minimum CPU requirement in the current environment is 1 core.
   
* The minimum available memory in the current environment is 2 GB.

* The jq command-line tool is installed in your environment, and systemd is correctly configured as the system and service manager.

* MySQL client are installed in your environment.

* The user you are using has permission to execute sudo commands.

## Deploy seekdb

### Step 1: Install seekdb

Depending on whether the environment can connect to an external network, there are two installation methods: online installation and offline installation.

#### Online installation

1. Add the seekdb repository

   ```shell
   sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
   ```

2. Install seekdb

   ```shell
   sudo yum install seekdb obclient
   ```

#### Offline installation

1. You can download the required version of seekdb from the [OceanBase Software Download Center](https://en.oceanbase.com/softwarecenter). After downloading, copy the installation package to your machine. It is recommended that you use the latest version of the installation package.

2. In the directory where the installation package is located, run the rpm command to install seekdb.

   ```shell
   sudo rpm -ivh seekdb-*.rpm
   ```

### Step 2: Start seekdb

After installing seekdb, you can start seekdb by following these steps.

1. (Optional) Modify the configuration file.

   You can modify the configuration file in this step. If not modified, the default configuration in the configuration file will be used for deployment.

   ```shell
   sudo vim /etc/oceanbase/seekdb.cnf
   ```

   The configuration items in this file are as follows:

   ```shell
   port=2881
   data-dir=/var/lib/oceanbase/store
   redo-dir=/var/lib/oceanbase/store/redo
   datafile_size=2G
   datafile_next=2G
   datafile_maxsize=50G
   cpu_count=4
   memory_limit=2G
   log_disk_size=2G
   ```

   The configuration items in the configuration file are described in the following table:

   | Configuration item | Required | Default value | Description |
   |----------|-----------|----------|----------|
   | port | Optional | 2881 | The SQL service protocol port number of seekdb. |
   | redo_dir | Optional | /var/lib/oceanbase/store/redo | Directory for clog, ilog, and slog. It is recommended to configure it as an independent disk.<main id="notice" type='explain'><h4>Note</h4><p>The available disk space of the data disk (default: <code>/var/lib/oceanbase/</code>) should be greater than 15 GB.</p></main> |
   | data_dir | Optional | /var/lib/oceanbase/store | Directory for storing SSTable and other data. It is recommended to configure it as an independent disk.<main id="notice" type='explain'><h4>Note</h4><p>The available disk space of the data disk (default: <code>/var/lib/oceanbase/</code>) should be greater than 15 GB.</p></main> |
   | datafile_size | Optional | 2G | Specifies the size of data files (block_file). If not configured, the `datafile_disk_percentage` configuration item is used. For details, see [datafile_size](https://en.oceanbase.com/docs/common-oceanbase-database-10000000001971955) and [datafile_disk_percentage](https://en.oceanbase.com/docs/common-oceanbase-database-10000000001971961). |
   | datafile_next | Optional | 2G | Specifies the growth step size of data files. |
   | datafile_maxsize | Optional | 50G | Specifies the maximum size of data files. |
   | cpu_count | Optional | 4 | Total number of CPUs that seekdb can use. If set to 0, it will be automatically detected. |
   | memory_limit | Optional | 2G | Maximum memory that seekdb can obtain from the environment. |
   | log_disk_size | Optional | 2G | Used to set the size of the Redo log disk. If not configured, the `log_disk_percentage` configuration item is used. For details, see [log_disk_size](https://en.oceanbase.com/docs/common-oceanbase-database-10000000001971764) and [log_disk_percentage](https://en.oceanbase.com/docs/common-oceanbase-database-10000000001971945). |

2. Start seekdb.

   ```shell
   sudo systemctl start seekdb
   ```

3. Check the startup status of seekdb.

   ```shell
   sudo systemctl status seekdb
   ```

   When the status displays `Service is ready`, it indicates that seekdb has started successfully.

### Step 3: Connect to seekdb

Here, connecting to seekdb through MySQL client is used as an example. The command is as follows:

```shell
mysql -h<IP> -uroot -P<Port> -p<Passwd> -A oceanbase
```

Parameter description:

* -h: Provides the seekdb connection IP. The default IP for seekdb started with systemd is `127.0.0.1`.

* -u: Provides the seekdb connection account in the format: `username`. The default username for seekdb instances is `root`.

* -P: Provides the seekdb connection port, which is the value of `port` in `/etc/oceanbase/seekdb.cnf`.

* -p: Provides the seekdb connection password. The default is empty.

* -A: Indicates that mysql client does not automatically obtain statistics when connecting to the database.

* oceanbase: The name of the database to access, which can be changed to a business database name.

## Manage seekdb

Currently, only start, stop, and status operations are supported for seekdb through systemd.

### Check seekdb status

You can run the following command to check the seekdb status.
  
```shell
sudo systemctl status seekdb
```

The seekdb status has the following scenarios:

* `Active` displays `active (running)`, and `Status` displays `seekdb is ready and running`, indicating that seekdb has started successfully.

* `Active` displays `inactive (dead)`, indicating that the service has stopped, that is, seekdb has stopped.

* `Active` displays `failed`, indicating that an error occurred in the service. You need to check the logs for troubleshooting.

### Clear seekdb

You can clear seekdb started with systemd by following these steps.

1. Stop seekdb.
  
   ```shell
   sudo systemctl stop seekdb
   ```

2. Uninstall seekdb.

   1. Delete the seekdb database package

      For online installation, you can run the following command:

      ```shell
      sudo yum erase seekdb
      ```

      `package` needs to be replaced with the name of the package to be deleted. You can check the package name using the `yum list | grep seekdb` command.

      For offline installation, you can run the following command:

      ```shell
      sudo rpm -e seekdb
      ```

      `package` needs to be replaced with the name of the package to be deleted. You can check the package name using the `rpm -qa | grep seekdb` command.

   2. Delete seekdb data.

      After executing the first step, the return result will display `To clean OceanBase : bash /var/lib/oceanbase/oceanbase_clean.sh`. You can use this command to completely delete seekdb.

      After executing this step to delete seekdb data, your deployed seekdb will be completely uninstalled.

      ```shell
      sudo bash /var/lib/oceanbase/oceanbase_clean.sh
      ```