01-pkg-install.md 6.1 KB
Newer Older
1 2 3 4 5 6 7 8
---
title: Install & Uninstall
description: Install, Uninstall, Start, Stop and Upgrade
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

9
TDengine community version provides deb and rpm packages for users to choose from, based on their system environment. The deb package supports Debian, Ubuntu and derivative systems. The rpm package supports CentOS, RHEL, SUSE and derivative systems. Furthermore, a tar.gz package is provided for TDengine Enterprise customers.
10 11 12

## Install

G
gccgdb1234 已提交
13
About details of installing TDenine, please refer to [Installation Guide](../../get-started/package/).
14 15 16 17 18 19 20 21 22 23 24

## Uninstall

<Tabs>
<TabItem label="Uninstall Deb" value="debuninst">

Deb package of TDengine can be uninstalled as below:

```bash
$ sudo dpkg -r tdengine
(Reading database ... 137504 files and directories currently installed.)
25
Removing tdengine (3.0.0.0) ...
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
TDengine is removed successfully!

```

</TabItem>

<TabItem label="Uninstall RPM" value="rpmuninst">

RPM package of TDengine can be uninstalled as below:

```
$ sudo rpm -e tdengine
TDengine is removed successfully!
```

</TabItem>

<TabItem label="Uninstall tar.gz" value="taruninst">

tar.gz package of TDengine can be uninstalled as below:

```
$ rmtaos
Nginx for TDengine is running, stopping it...
TDengine is removed successfully!

taosKeeper is removed successfully!
```

</TabItem>
</Tabs>

:::note

60 61
- We strongly recommend not to use multiple kinds of installation packages on a single host TDengine. 
- After deb package is installed, if the installation directory is removed manually, uninstall or reinstall will not work. This issue can be resolved by using the command below which cleans up TDengine package information. You can then reinstall if needed.
62 63 64 65 66

```bash
   $ sudo rm -f /var/lib/dpkg/info/tdengine*
```

67
- After rpm package is installed, if the installation directory is removed manually, uninstall or reinstall will not work. This issue can be resolved by using the command below which cleans up TDengine package information. You can then reinstall if needed.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97

```bash
   $ sudo rpm -e --noscripts tdengine
```

:::

## Installation Directory

TDengine is installed at /usr/local/taos if successful.

```bash
$ cd /usr/local/taos
$ ll
$ ll
total 28
drwxr-xr-x  7 root root 4096 Feb 22 09:34 ./
drwxr-xr-x 12 root root 4096 Feb 22 09:34 ../
drwxr-xr-x  2 root root 4096 Feb 22 09:34 bin/
drwxr-xr-x  2 root root 4096 Feb 22 09:34 cfg/
lrwxrwxrwx  1 root root   13 Feb 22 09:34 data -> /var/lib/taos/
drwxr-xr-x  2 root root 4096 Feb 22 09:34 driver/
drwxr-xr-x 10 root root 4096 Feb 22 09:34 examples/
drwxr-xr-x  2 root root 4096 Feb 22 09:34 include/
lrwxrwxrwx  1 root root   13 Feb 22 09:34 log -> /var/log/taos/
```

During the installation process:

- Configuration directory, data directory, and log directory are created automatically if they don't exist
98
- The default configuration file is located at /etc/taos/taos.cfg, which is a copy of /usr/local/taos/cfg/taos.cfg
99 100 101 102 103 104 105 106
- The default data directory is /var/lib/taos, which is a soft link to /usr/local/taos/data
- The default log directory is /var/log/taos, which is a soft link to /usr/local/taos/log
- The executables at /usr/local/taos/bin are linked to /usr/bin
- The DLL files at /usr/local/taos/driver are linked to /usr/lib
- The header files at /usr/local/taos/include are linked to /usr/include

:::note

107
- When TDengine is uninstalled, the configuration /etc/taos/taos.cfg, data directory /var/lib/taos, log directory /var/log/taos are kept. They can be deleted manually with caution, because data can't be recovered. Please follow data integrity, security, backup or relevant SOPs before deleting any data.
108 109 110 111
- When reinstalling TDengine, if the default configuration file /etc/taos/taos.cfg exists, it will be kept and the configuration file in the installation package will be renamed to taos.cfg.orig and stored at /usr/local/taos/cfg to be used as configuration sample. Otherwise the configuration file in the installation package will be installed to /etc/taos/taos.cfg and used.

## Start and Stop

S
Sean Ely 已提交
112
Linux system services `systemd`, `systemctl` or `service` are used to start, stop and restart TDengine. The server process of TDengine is `taosd`, which is started automatically after the Linux system is started. System operators can use `systemd`, `systemctl` or `service` to start, stop or restart TDengine server.
113

S
Sean Ely 已提交
114
For example, if using `systemctl` , the commands to start, stop, restart and check TDengine server are below:
115 116 117 118 119 120 121 122 123

- Start server:`systemctl start taosd`

- Stop server:`systemctl stop taosd`

- Restart server:`systemctl restart taosd`

- Check server status:`systemctl status taosd`

124
Another component named as `taosAdapter` is to provide HTTP service for TDengine, it should be started and stopped using `systemctl`.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

If the server process is OK, the output of `systemctl status` is like below:

```
Active: active (running)
```

Otherwise, the output is as below:

```
Active: inactive (dead)
```

## Upgrade

There are two aspects in upgrade operation: upgrade installation package and upgrade a running server.

142
To upgrade a package, follow the steps mentioned previously to first uninstall the old version then install the new version.
143

144
Upgrading a running server is much more complex. First please check the version number of the old version and the new version. The version number of TDengine consists of 4 sections, only if the first 3 sections match can the old version be upgraded to the new version. The steps of upgrading a running server are as below:
145 146

- Stop inserting data
147 148
- Make sure all data is persisted to disk
- Make some simple queries (Such as total rows in stables, tables and so on. Note down the values. Follow best practices and relevant SOPs.)
149 150 151
- Stop the cluster of TDengine
- Uninstall old version and install new version
- Start the cluster of TDengine
152 153 154
- Execute simple queries, such as the ones executed prior to installing the new package, to make sure there is no data loss
- Run some simple data insertion statements to make sure the cluster works well
- Restore business services
155 156

:::warning
S
Sean Ely 已提交
157

158 159 160
TDengine doesn't guarantee any lower version is compatible with the data generated by a higher version, so it's never recommended to downgrade the version.

:::