From 08b6b0d222a1accfbb26f730fd93336c6fbd9b45 Mon Sep 17 00:00:00 2001 From: Pan YANG Date: Fri, 13 May 2022 22:38:04 +0800 Subject: [PATCH] feat: instruments and .plist file for running taosd as macOS service (#12332) * feat: instruments and .plist file for running taosd as macOS service * fix: move macOS/com.taosdata.tdengine.plist to packaging folder --- README-CN.md | 48 ++++++++++++++-- README.md | 64 +++++++++++++++++---- packaging/macOS/com.taosdata.tdengine.plist | 22 +++++++ 3 files changed, 117 insertions(+), 17 deletions(-) create mode 100644 packaging/macOS/com.taosdata.tdengine.plist diff --git a/README-CN.md b/README-CN.md index b86e2d83b5..e29495fdd0 100644 --- a/README-CN.md +++ b/README-CN.md @@ -126,7 +126,7 @@ sudo yum install zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfi 注意:由于 snappy 缺乏 pkg-config 支持 (参考 [链接](https://github.com/google/snappy/pull/86)),会导致 - cmake 提示无法发现 libsnappy,实际上工作正常。 +cmake 提示无法发现 libsnappy,实际上工作正常。 ## 获取源码 @@ -229,13 +229,17 @@ cmake .. && cmake --build . # 安装 -生成完成后,安装 TDengine(下文给出的指令以 Linux 为例,如果是在 Windows 下,那么对应的指令会是 `nmake install`): +## Linux 系统 + +生成完成后,安装 TDengine: ```bash sudo make install ``` 用户可以在[文件目录结构](https://www.taosdata.com/cn/documentation/administrator#directories)中了解更多在操作系统中生成的目录或文件。 +从 2.0 版本开始, 从源代码安装也会为 TDengine 配置服务管理。 +用户也可以选择[从安装包中安装](https://www.taosdata.com/en/getting-started/#Install-from-Package)。 安装成功后,在终端中启动 TDengine 服务: @@ -251,6 +255,40 @@ taos 如果 TDengine Shell 连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印出错误消息。 +## Windows 系统 + +生成完成后,安装 TDengine: + +```cmd +nmake install +``` + +## macOS 系统 + +生成完成后,安装 TDengine: + +```bash +sudo make install +``` + +安装成功后,如果想以服务形式启动,先配置 `.plist` 文件,在终端中执行: + +```bash +sudo cp ../packaging/macOS/com.taosdata.tdengine.plist /Library/LaunchDaemons +``` + +在终端中启动 TDengine 服务: + +```bash +sudo launchctl load /Library/LaunchDaemons/com.taosdata.tdengine.plist +``` + +在终端中停止 TDengine 服务: + +```bash +sudo launchctl unload /Library/LaunchDaemons/com.taosdata.tdengine.plist +``` + ## 快速运行 如果不希望以服务方式运行 TDengine,也可以在终端中直接运行它。也即在生成完成后,执行以下命令(在 Windows 下,生成的可执行文件会带有 .exe 后缀,例如会名为 taosd.exe ): @@ -271,7 +309,7 @@ taos 在 TDengine 终端中,用户可以通过 SQL 命令来创建/删除数据库、表等,并进行插入查询操作。 -```bash +```sql CREATE DATABASE demo; USE demo; CREATE TABLE t (ts TIMESTAMP, speed INT); @@ -325,8 +363,8 @@ TDengine 的测试框架和所有测试例全部开源。 # 加入技术交流群 -TDengine 官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。 +TDengine 官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小 T 为好友,即可入群。 -# [谁在使用TDengine](https://github.com/taosdata/TDengine/issues/2432) +# [谁在使用 TDengine](https://github.com/taosdata/TDengine/issues/2432) 欢迎所有 TDengine 用户及贡献者在 [这里](https://github.com/taosdata/TDengine/issues/2432) 分享您在当前工作中开发/使用 TDengine 的故事。 diff --git a/README.md b/README.md index 204dc98725..07d70c2dd1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ TDengine can be widely applied to Internet of Things (IoT), Connected Vehicles, # Documentation For user manual, system design and architecture, engineering blogs, refer to [TDengine Documentation](https://www.taosdata.com/en/documentation/)(中文版请点击[这里](https://www.taosdata.com/cn/documentation20/)) - for details. The documentation from our website can also be downloaded locally from *documentation/tdenginedocs-en* or *documentation/tdenginedocs-cn*. +for details. The documentation from our website can also be downloaded locally from _documentation/tdenginedocs-en_ or _documentation/tdenginedocs-cn_. # Building @@ -258,7 +258,9 @@ cmake .. && cmake --build . # Installing -After building successfully, TDengine can be installed by: (On Windows platform, the following command should be `nmake install`) +## On Linux platform + +After building successfully, TDengine can be installed by ```bash sudo make install @@ -281,7 +283,7 @@ taos If TDengine shell connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown. -## Install TDengine by apt-get +### Install TDengine by apt-get If you use Debian or Ubuntu system, you can use 'apt-get' command to install TDengine from official repository. Please use following commands to setup: @@ -294,6 +296,40 @@ apt-cache policy tdengine sudo apt-get install tdengine ``` +## On Windows platform + +After building successfully, TDengine can be installed by: + +```cmd +nmake install +``` + +## On macOS platform + +After building successfully, TDengine can be installed by: + +```bash +sudo make install +``` + +To start the service after installation, config `.plist` file first, in a terminal, use: + +```bash +sudo cp ../packaging/macOS/com.taosdata.tdengine.plist /Library/LaunchDaemons +``` + +To start the service, in a terminal, use: + +```bash +sudo launchctl load /Library/LaunchDaemons/com.taosdata.tdengine.plist +``` + +To stop the service, in a terminal, use: + +```bash +sudo launchctl unload /Library/LaunchDaemons/com.taosdata.tdengine.plist +``` + ## Quick Run If you don't want to run TDengine as a service, you can run it in current shell. For example, to quickly start a TDengine server after building, run the command below in terminal: (We take Linux as an example, command on Windows will be `taosd.exe`) @@ -315,13 +351,17 @@ option "-c test/cfg" specifies the system configuration file directory. It is easy to run SQL commands from TDengine shell which is the same as other SQL databases. ```sql -create database db; -use db; -create table t (ts timestamp, a int); -insert into t values ('2019-07-15 00:00:00', 1); -insert into t values ('2019-07-15 01:00:00', 2); -select * from t; -drop database db; +CREATE DATABASE demo; +USE demo; +CREATE TABLE t (ts TIMESTAMP, speed INT); +INSERT INTO t VALUES('2019-07-15 00:00:00', 10); +INSERT INTO t VALUES('2019-07-15 01:00:00', 20); +SELECT * FROM t; + ts | speed | +=================================== + 19-07-15 00:00:00.000| 10| + 19-07-15 01:00:00.000| 20| +Query OK, 2 row(s) in set (0.001700s) ``` # Developing with TDengine @@ -348,8 +388,8 @@ The TDengine community has also kindly built some of their own connectors! Follo # How to run the test cases and how to add a new test case - TDengine's test framework and all test cases are fully open source. - Please refer to [this document](https://github.com/taosdata/TDengine/blob/develop/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case. +TDengine's test framework and all test cases are fully open source. +Please refer to [this document](https://github.com/taosdata/TDengine/blob/develop/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case. # TDengine Roadmap diff --git a/packaging/macOS/com.taosdata.tdengine.plist b/packaging/macOS/com.taosdata.tdengine.plist new file mode 100644 index 0000000000..6e41a3bbf7 --- /dev/null +++ b/packaging/macOS/com.taosdata.tdengine.plist @@ -0,0 +1,22 @@ + + + + + KeepAlive + + Label + com.taosdata.tdengine.taosd + Program + /usr/local/bin/taosd + ProgramArguments + + /usr/local/bin/taosd + + RunAtLoad + + SessionCreate + + StandardOutPath + /var/log/tdengine.log + + \ No newline at end of file -- GitLab