linux二进制包安装unvdb

安装过程

上传二进制数据包

使用winscp或者其他上传工具,尽量不要使用lszrz 此插件有不明问题,数据包一但超过一定大小就有几率会在上传时产生损坏,导致文件出错不可用。

文件包上传到的地址为 /tmp

准备安装目录和数据存储目录和普通用户

useradd udb #创建普通用户

mkdir -p /data/soft /data/udb /data/backup #创建目录

unzip unvdb-tx-2.4.32-linux-x86_64.zip -d /data/soft #解压文件

chown -R udb.udb /data/udb /data/soft /data/backup /data/soft/unvdb-tx-2.4.32-linux-x86_64 #此命令更改属主,属组

ln -s /data/soft/unvdb-tx-2.4.32-linux-x86_64/ /data/soft/unvdb #创建软链接

cd /data/soft/unvdb-tx-2.4.32-linux-x86_64 

su udb

启动安装程序

[udb@localhost unvdb-tx-2.4.32-linux-x86_64]$ ./setup.sh
===============================================================================
Welcome
-------
This installer will guide you through the installation of UnvDB.
Version:  2.4
Web:      http://www.unvdb.com
Tel:      0755-84185890
You may quit the installer by typing "Exit",
or press <ENTER> key to continue:       #此段是说明回车就行
===============================================================================
License Agreement
-----------------
Installation and Use of UnvDB Requires Acceptance of the Following 
License Agreement:
UniversalDB (Shenzhen) Technology Co., Ltd.
"SOFTWARE END-USER LICENSE AGREEMENT"
The "software product" includes computer software, and may include 
associated media, documentation.
This "software product" includes any upgrade and supplemental 
materials to the original "software product" provided by UnvDB.
SOFTWARE PRODUCT LICENSE
The "software product" is under the protection of Copyrights 
and International Conventions.
You may disagree the license by typing "Exit",
or press <ENTER> key to continue:        #此段是用户协议同意回车就行不同意"Exit"
===============================================================================
Choose Data Folder
------------------
Please choose a data folder for this installation.
The data folder must be empty and writable.
Default Data Folder: /data/soft/unvdb-data
Enter the absolute path, 
or press <ENTER> key to accept the default, 
    : /data/udb #此处输入数据存放目录
===============================================================================
Port
----
Please enter UnvDB listen port.
Port (Default: 5678): 
===============================================================================
Username
--------
Please enter UnvDB username.
Username (Default: unvdb): #管理员用户名
===============================================================================
Password
--------
Please enter password: #管理员密码
Password again
--------------
Please enter password again :  #再输入一次
===============================================================================
Ready To Install
----------------
It will start to install UnvDB.
Product Name: UnvDB v22.4
Data Folder: /data/udb
Port: 5678
Username: unvdb
You may quit the installer by typing "Exit",
or press <ENTER> key to continue: 
The files belonging to this database system will be owned by user "unvdb".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /data/udb ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
===============================================================================
Installation Complete
---------------------
Congratulations. UnvDB has been successfully installed to:
    /data/udb
It is a demo version now, free use for 90 days.
To run as official version,
Contact UniversalDB(Shenzhen) Technology Co.,Ltd.
And copy license file to the installed path.
If you want to register UnvDB as service, please run
    sudo /data/udb/service.sh
or start UnvDB without service, please run
    /data/udb/start.sh

载入变量并验证

返回root用户
/data/udb/service.sh
[root@localhost soft]# systemctl start unvdb #启动服务
[root@localhost soft]# source /data/soft/unvdb/env.sh #载入环境变量
[root@localhost soft]# ud_sql  #进入udb
如果不是默认用户请输入# ud_sql -U 用户名 unvdb  
由于ud_sql是登录默认用户所以不是默认用户使用的话会显示以下错误
[root@localhost soft]# ud_sql
ud_sql: error: connection to server at "localhost" (::1), port 5678 failed: FATAL:  role "unvdb" does not exist

[root@localhost ~]# ud_sql
ud_sql (2.4)
Type "help" for help.

unvdb=# \l
                              List of databases
   Name    | Owner | Encoding |   Collate   |    Ctype    | Access privileges 
-----------+-------+----------+-------------+-------------+-------------------
 template0 | unvdb | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/unvdb         +
           |       |          |             |             | unvdb=CTc/unvdb
 template1 | unvdb | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/unvdb         +
           |       |          |             |             | unvdb=CTc/unvdb
 unvdb     | unvdb | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | 
(3 rows)

卸载数据库

注意 请备份好数据再执行以下操作

systemctl stop {unvdb端口号,udb_exporter,node_exporter,filebeat} #停止 数据库,数据库监控,服务器监控,日志文件收集 服务
rm -fr /lib/systemd/system/{unvdb5678.service,udb_exporter.service,filebeat.service,node_exporter.service} #删除服务文件
mv /data/udb /data/udb-del #转移数据目录,如确定不再需要也可 rm 删除
userdel -r unvdb #删除用户和目录,请提前备份用户目录内的数据
rm -fr /tmp/ud_autoctl #删除临时文件