LightDB单机安装
LightDB官网:https://www.hs.net/lightdb
下载安装包:lightdb-x-13.8-22.3-7953-el7.x86_64.zip
前置准备
-
防火墙配置(选择一种操作)
- firewall防火墙
firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=123/udp
- iptables防火墙
iptables -A INPUT -p tcp --dport 5432 -j ACCEPT iptables -A INPUT -p udp --dport 123 -j ACCEPT
- 直接关闭防火墙
systemctl stop firewalld.service systemctl disable firewalld.service systemctl stop NetworkManager.service systemctl disable NetworkManager.service
-
关闭 SELINUX
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce 0
-
检查时间和时区
[root@localhost lib64]# timedatectl
Local time: 五 2023-01-06 16:06:20 CST
Universal time: 五 2023-01-06 08:06:20 UTC
RTC time: 五 2023-01-06 08:06:20
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
如果需要修改可以执行:
#时区列表
$ timedatectl list-timezones
#设定时区
$ timedatectl set-timezone Asia/Shanghai
-
安装依赖包
以下执行命令过多,可以创建一个bash可执行文件,统一运行(示例)
$ touch pack.sh
$ vi pack.sh
$ chmod 777 pack.sh
$ ./pack.sh
# 安 装 包 通 用 运 行 依 赖 ,GUI安 装 和 命 令 行 安 装 均 需 要
yum install -y procps-ng
yum install -y coreutils
# GUI安 装 运 行 依 赖 , 仅GUI安 装 需 要
yum install -y gtk2
yum install -y libXtst
yum install -y dejavu-fonts # 麒 麟v10sp1可 能 需 要 安 装 字 体
# 数 据 库 的 运 行 依 赖
yum install -y readline
yum install -y zlib
yum install -y libxml2
yum install -y openssl-libs
yum install -y uuid
yum install -y c-ares libpcap snappy # tshark
yum install -y ncurses-libs # iftop
yum install -y libnl3 # keepalived ipv6
yum install -y libzstd # canopy
yum install -y sysstat
yum install -y json-c
yum install -y libicu
-
创建 lightdb 用户并设置 sudo 免密
#创建组(lightdb)
$ groupadd lightdb
#创建用户(lightdb)
$ useradd -g lightdb -m lightdb
#设置密码
$ passwd lightdb
#设置免密
#修改sudoers文件权限
$ chmod 755 /etc/sudoers
$ vi /etc/sudoers
追加一行:lightdb ALL=(ALL) NOPASSWD: ALL
$ chmod 440 /etc/sudoers
-
创建 LightDB 安装目录和实例目录
#创建安装目录
$ mkdir -p /usr/local/lightdb
# 修改目录所属用户和组
$ chown -R lightdb:lightdb /usr/local/lightdb
实例目录默认路径为:安装目录下
修改默认实例目录示例:
$ mkdir -p /data/lightdb_data
$ chown -R lightdb:lightdb /data/lightdb_data
-
配置操作系统内核参数
echo "kernel.shmmni=4096" >> /etc/sysctl.conf
echo "kernel.shmmax=$(expr $(getconf _PHYS_PAGES) / 2 \* $(getconf PAGE_SIZE))" \
>> /etc/sysctl.conf
echo "kernel.shmall=$(expr $(getconf _PHYS_PAGES) / 2)" >> /etc/sysctl.conf
echo "kernel.sem=500 2048000 200 4096" >> /etc/sysctl.conf
echo "fs.aio-max-nr=1048576" >> /etc/sysctl.conf
echo "fs.file-max=524288" >> /etc/sysctl.conf
echo "vm.swappiness=5" >> /etc/sysctl.conf
echo "vm.overcommit_memory=2" >> /etc/sysctl.conf
echo "vm.overcommit_ratio=75" >> /etc/sysctl.conf
echo "vm.dirty_background_ratio=5" >> /etc/sysctl.conf
echo "vm.dirty_ratio=40" >> /etc/sysctl.conf
echo "vm.dirty_expire_centisecs=500" >> /etc/sysctl.conf
echo "vm.dirty_writeback_centisecs=250" >> /etc/sysctl.conf
echo "net.core.somaxconn=2000" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_syn_backlog=2000" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse=1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_syn_retries=3" >> /etc/sysctl.conf
echo "net.ipv4.tcp_retries2=5" >> /etc/sysctl.conf
echo "net.ipv4.tcp_slow_start_after_idle=0" >> /etc/sysctl.conf
执行: sysctl -p
-
配置 limits.conf
echo "lightdb hard core unlimited" >> /etc/security/limits.conf
echo "lightdb soft core unlimited" >> /etc/security/limits.conf
echo "lightdb hard nofile 524288" >> /etc/security/limits.conf
echo "lightdb soft nofile 524288" >> /etc/security/limits.conf
echo "lightdb hard nproc 16384" >> /etc/security/limits.conf
echo "lightdb soft nproc 16384" >> /etc/security/limits.conf
-
切换到lightdb用户执行
$ su - lightdb
$ ulimit -c
$ ulimit -n
$ ulimit -u
安装操作
-
准备lightdb安装包
-
解压lightdb安装包
unzip lightdb-x-13.8-22.3-7953-el7.x86_64.zip
-
执行安装脚本(在lightdb用户下执行)
$ cd lightdb-x-13.8-22.3-7953-el7.x86_64
$ ./install.sh
-
命令行方式安装
Whether to use the graphical user interface (GUI, Make sure DISPLAY is configured, Such as [export DISPLAY=127.0.0.1:0.0])?(Yes or No)
no
Choice a kind of configuration mode!
1: Only install.
2: Install database and Create instance.
3: Developer
Please enter 1 2 or 3(The default is 1):
2
Choice a kind of install mode!
1: Single Mode.
2: High Availability Mode
3: Distributed Mode
Please enter 1, 2 or 3:(The default is 1)
1
Assign a port to the LightDB!
Listen Port(The default port is 5432):
Check system parameters and dependency packages!
========================================= 10.188.122.215 =========================================
NETWORK
name: sem, recommend value: 500,2048000,200,4096, current value: 500,2048000,200,4096, status: OK
name: aio_max_nr, recommend value: 1048576, current value: 1048576, status: OK
name: somaxconn, recommend value: 2000, current value: 2000, status: OK
name: tcp_max_syn_backlog, recommend value: 2000, current value: 2000, status: OK
name: tcp_tw_reuse, recommend value: 1, current value: 1, status: OK
name: tcp_syn_retries, recommend value: 3, current value: 3, status: OK
name: tcp_retries2, recommend value: 5, current value: 5, status: OK
name: tcp_slow_start_after_idle, recommend value: 0, current value: 0, status: OK
PAGE_CACHE
name: dirty_background_ratio, recommend value: 5, current value: 5, status: OK
name: dirty_ratio, recommend value: 40, current value: 40, status: OK
name: dirty_expire_centisecs, recommend value: 500, current value: 500, status: OK
name: dirty_writeback_centisecs, recommend value: 250, current value: 250, status: OK
MEMORY
name: shmmni, recommend value: 4096, current value: 4096, status: OK
name: shmmax, recommend value: 1976979456, current value: 1976979456, status: OK
name: shmall, recommend value: 482661, current value: 482661, status: OK
name: swappiness, recommend value: 5, current value: 5, status: OK
name: overcommit_memory, recommend value: 2, current value: 2, status: OK
name: overcommit_ratio, recommend value: 75, current value: 75, status: OK
FILE_HANDLER
name: file_max, recommend value: 524288, current value: 524288, status: OK
ULIMIT
name: ulimit_core, recommend value: unlimited, current value: unlimited, status: OK
name: ulimit_nofile, recommend value: 8192, current value: 524288, status: OK
Dependency Package
name: JSON-C-0.11 is existed: yes
name: C-ARES-1 is existed: yes
name: LIBNL3 is existed: yes
name: LIBPCAP-1 is existed: yes
name: LIBZSTD-1 is existed: yes
name: LZ4-1 is existed: yes
name: NCURSES-LIBS-5 is existed: yes
name: READLINE-6 is existed: yes
name: SNAPPY-1 is existed: yes
name: UUID-1.6 is existed: yes
name: LIBICU-50 is existed: yes
Choice a kind of Compatible Type!
1: LightdDB(Compatible with PostgreSQL).
2: ORACLE(Compatible with ORACLE).
3: MYSQL(Compatible with MYSQL).
Please enter 1, 2 or 3:(The default is 1)
1
Choice a kind of Compatible Type!
1: LightdDB(Compatible with PostgreSQL).
2: ORACLE(Compatible with ORACLE).
3: MYSQL(Compatible with MYSQL).
Please enter 1, 2 or 3:(The default is 1)
1
Choice a kind of LightDB workload!
1: OLTP(On-line Transaction Processing).
2: OLAP(On-Line Analytical Processing).
Please enter 1 or 2:(The default is 1)
1
Specify a path for installing all LightDB software and storing configuration information.
Please enter base location(The default is /usr/local/lightdb):
Base Location: /usr/local/lightdb
Install Location: /usr/local/lightdb/lightdb-x/13.8-22.3
Please enter instance location(The default is /usr/local/lightdb/lightdb-x/13.8-22.3/data/defaultCluster/):
Instance location: /usr/local/lightdb/lightdb-x/13.8-22.3/data/defaultCluster/
Please configure memory(MB) and character set!
Please enter shared_buffers, Default value is (942):
Please enter effective_cache_size, Default value is (2639):
Please choice a kind of Character Set.
1. UTF8
2. GBK
3. SQL_ASCII
4. LATIN1
The default choice 1(UTF8)
1
Please enter LightDB password!
Please enter original password:
Please enter confirm password:
The original password and confirm password are different one times. Please try again!
Confirm Password must not be null!
Do you want to deploy immediately?(Yes or No, The default is yes)
yes
[>>>>>>>>>>>>>>> ] 30%
- 刷新下.bashrc
[lightdb@localhost ~]$ source .bashrc
-
GUI方式安装
- 宿主机Windows上安装并运行:Xmanager - Passive
- 虚拟机centos7配置 DISPLAY 环境变量
#命令格式
export DISPLAY=Windows IP:0.0
#IP为运行Xmanager-Passive的系统IP
#【:】后的值为Passive运行后的状态提示,通常为0.0
# 以下命令在lightdb用户下执行
$ export DISPLAY=10.188.122.214:0.0
- 安装GUI依赖包
yum install -y libXtst gtk2 libX11
- 执行安装脚本
$ ./install.sh
Whether to use the graphical user interface (GUI, Make sure DISPLAY is configured, Such as [export DISPLAY=127.0.0.1:0.0])?(Yes or No)
yes
- 按照引导进行安装
-
安装问题
- LIBZSTD-1 not existed
查看lightdb-x-13.8-22.3-7953-el7.x86_64/system-lib目录 [root@localhost system-lib]# rpm -hvi libzstd-1.5.2-1.el7.x86_64.rpm 警告:libzstd-1.5.2-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY 准备中... ################################# [100%] 软件包 libzstd-1.5.2-1.el7.x86_64 已经安装
- file_max, recommend value: 524288,..., status: ERROR
注意配置操作系统内核参数后执行:sysctl -p
- DISPLAY无法开启
注意下export DISPLAY=xx 的执行用户