LightDB分布式部署-单机多实例模式
-
分布式部署模式
# 1.常规模式
1台服务器作为协调者节点,N(N>1)台服务器作为工作节点,每个节点都按照高可用方式进行部署
比如,一个协调节点,2个工作节点,
* 工作节点按照一主一从高可用方式部署,则一共需要[(1+2)*2=6台]服务器
* 工作节点按照一主一从一witness方式部署,则一共需要[(1+2)*3=9台]服务器
# 2.多机单实例
1台服务器作为协调者节点,N(N>1)台服务器作为工作节点,每个节点都按照单机模式部署
# 3.单机多实例
使用1台服务器同时安装协调者节点和工作节点的实例,所有实例均按照单机模式部署
生产环境仅建议使用常规模式部署。
单机多实例安装时默认创建1个协调节点(CN节点),2个work节点,可以在安装过程中调整work节点数量。
-
命令行安装过程
[lightdb@localhost 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)
3
Please select distributed mode!
Please enter distributed mode:
1 Normal mode;
2 Multi-server single instance;
3 Single server multi-instance.(Default 1)
3
Specify a path for installing all LightDB software and storing configuration information.
Please enter base location(The default is /usr/local/lightdb):
/usr/local/lightdb-dis
Base Location: /usr/local/lightdb-dis
Install Location: /usr/local/lightdb-dis/lightdb-x/13.8-22.3
Configure the directory and port for the single-node multi-instance.
Please enter the instance location of coordinator node. (Default location /usr/local/lightdb-dis/data) : --- CN节点存储位置
Please enter the port of coordinator node. (Default port 5432): --- CN节点端口
5433
Please enter the instance location of worker node. (Default location /usr/local/lightdb-dis/data) : --- work1节点存储位置
/usr/local/lightdb-dis/data1
Please enter the port of worker node. (Default port 5432): --- work1节点端口
5434
Please enter the instance location of worker node. (Default location /usr/local/lightdb-dis/data) : --- work2节点存储位置
/usr/local/lightdb-dis/data2
Please enter the port of worker node. (Default port 5432): --- work2节点端口
5435
Continue to add worker node(1[yes],2[no])?
no
======================================= Instances =======================================
Coordinator Node /usr/local/lightdb-dis/data 5433
Worker Node /usr/local/lightdb-dis/data1 5434
Worker Node /usr/local/lightdb-dis/data2 5435
======================================= Instances =======================================
Please check the instances of Single server multi-instance. 1 continue; 2 clear server config (Default 1)
1
Check system parameters and dependency packages!
========================================= 192.168.121.111 =========================================
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 LightDB workload!
1: OLTP(On-line Transaction Processing).
2: OLAP(On-Line Analytical Processing).
Please enter 1 or 2:(The default is 1)
1
Please configure memory(MB) and character set!
Please enter shared_buffers, Default value is (942): --- 25% * 总物理内存
Please enter effective_cache_size, Default value is (2639): --- 70% * 总物理内存
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:
Do you want to deploy immediately?(Yes or No, The default is yes)
yes
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]100%
Choose whether to install LVS to load balance coordinator node ?(Yes or No,The default is no)
no
Install Finish
-
查看安装进程
[lightdb@localhost lightdb-x-13.8-22.3-7953-el7.x86_64]$ ps aux|grep lightdb
root 1578 0.0 0.0 191892 2348 pts/0 S 09:32 0:00 su - lightdb
lightdb 1579 0.0 0.0 115544 2080 pts/0 S 09:32 0:00 -bash
lightdb 3549 10.0 9.5 1708412 368572 ? Ss 09:51 0:04 /usr/local/lightdb-dis/lightdb-x/13.8-22.3/bin/lightdb -D /usr/local/lightdb-dis/data
lightdb 3552 0.0 0.1 292232 4696 ? Ss 09:51 0:00 lightdb: logger
lightdb 3554 0.0 0.1 1708412 4756 ? Ss 09:51 0:00 lightdb: checkpointer
lightdb 3555 0.5 0.2 1709944 11580 ? Ss 09:51 0:00 lightdb: background writer
lightdb 3556 0.1 3.5 1708412 136192 ? Ss 09:51 0:00 lightdb: walwriter
lightdb 3557 0.0 0.1 1712480 6040 ? Ss 09:51 0:00 lightdb: autovacuum launcher
lightdb 3558 0.0 0.1 294772 4856 ? Ss 09:51 0:00 lightdb: stats collector
lightdb 3559 0.2 0.3 1713768 14312 ? Ss 09:51 0:00 lightdb: lt_cron launcher
lightdb 3560 0.0 0.1 1712404 5756 ? Ss 09:51 0:00 lightdb: logical replication launcher
lightdb 3561 0.0 0.4 1714592 15464 ? Ss 09:51 0:00 lightdb: Canopy Maintenance Daemon: 14198/10
lightdb 3577 12.5 9.5 1708412 368572 ? Ss 09:51 0:04 /usr/local/lightdb-dis/lightdb-x/13.8-22.3/bin/lightdb -D /usr/local/lightdb-dis/data1
lightdb 3584 0.0 0.1 292232 4696 ? Ss 09:51 0:00 lightdb: logger
lightdb 3586 0.0 0.1 1708412 4756 ? Ss 09:51 0:00 lightdb: checkpointer
lightdb 3587 0.5 0.2 1709944 11320 ? Ss 09:51 0:00 lightdb: background writer
lightdb 3588 0.1 3.5 1708412 136192 ? Ss 09:51 0:00 lightdb: walwriter
lightdb 3589 0.0 0.1 1712480 6044 ? Ss 09:51 0:00 lightdb: autovacuum launcher
lightdb 3590 0.0 0.1 294772 4856 ? Ss 09:51 0:00 lightdb: stats collector
lightdb 3591 0.3 0.3 1713736 14176 ? Ss 09:51 0:00 lightdb: lt_cron launcher
lightdb 3592 0.0 0.1 1712404 5756 ? Ss 09:51 0:00 lightdb: logical replication launcher
lightdb 3593 0.0 0.3 1714448 15344 ? Ss 09:51 0:00 lightdb: Canopy Maintenance Daemon: 14198/10
lightdb 3608 12.6 9.5 1708420 368576 ? Ss 09:51 0:04 /usr/local/lightdb-dis/lightdb-x/13.8-22.3/bin/lightdb -D /usr/local/lightdb-dis/data2
lightdb 3618 0.0 0.1 292240 4700 ? Ss 09:51 0:00 lightdb: logger
lightdb 3620 0.0 0.1 1708420 4760 ? Ss 09:51 0:00 lightdb: checkpointer
lightdb 3621 0.5 0.2 1709952 11064 ? Ss 09:51 0:00 lightdb: background writer
lightdb 3622 0.1 3.5 1708420 136196 ? Ss 09:51 0:00 lightdb: walwriter
lightdb 3623 0.0 0.1 1712488 6048 ? Ss 09:51 0:00 lightdb: autovacuum launcher
lightdb 3624 0.0 0.1 294780 4864 ? Ss 09:51 0:00 lightdb: stats collector
lightdb 3625 0.3 0.3 1713744 14076 ? Ss 09:51 0:00 lightdb: lt_cron launcher
lightdb 3626 0.0 0.1 1712412 5760 ? Ss 09:51 0:00 lightdb: logical replication launcher
lightdb 3627 0.0 0.4 1714456 15608 ? Ss 09:51 0:00 lightdb: Canopy Maintenance Daemon: 14198/10
lightdb 3779 0.0 0.4 1716604 15672 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(56670) idle
lightdb 3780 0.0 0.4 1716596 15660 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(35000) idle
lightdb 3782 0.0 0.4 1716596 15744 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(53420) idle
lightdb 3783 0.0 0.4 1716604 15668 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(56678) idle
lightdb 3784 0.0 0.4 1716596 15660 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(53424) idle
lightdb 3785 0.0 0.4 1716596 15652 ? Ss 09:51 0:00 lightdb: lightdb postgres 127.0.0.1(35010) idle
lightdb 3871 0.0 0.0 155448 1872 pts/0 R+ 09:52 0:00 ps aux
lightdb 3872 0.0 0.0 112832 984 pts/0 S+ 09:52 0:00 grep --color=auto lightdb
- #### 查看安装目录
[lightdb@localhost lightdb-dis]$ cd /usr/local/lightdb-dis/ [lightdb@localhost lightdb-dis]$ ll 总用量 12 drwx------ 21 lightdb lightdb 4096 1月 16 09:51 data drwx------ 21 lightdb lightdb 4096 1月 16 09:51 data1 drwx------ 21 lightdb lightdb 4096 1月 16 09:51 data2 drwxrwxr-x 9 lightdb lightdb 140 1月 16 09:50 jdk drwxrwxr-x 3 lightdb lightdb 23 1月 16 09:49 lightdb-x drwxrwxr-x 3 lightdb lightdb 22 1月 16 09:50 lt_data drwxrwxr-x 3 lightdb lightdb 22 1月 16 09:50 lt_data1 drwxrwxr-x 3 lightdb lightdb 22 1月 16 09:51 lt_data2 drwxrwxr-x 3 lightdb lightdb 107 1月 16 09:50 uninstall [lightdb@localhost lightdb-dis]$
- #### 数据库访问
```sql
[lightdb@localhost ~]$ ltsql -h localhost -p 5433
[lightdb@localhost ~]$ ltsql -h localhost -p 5434
[lightdb@localhost ~]$ ltsql -h localhost -p 5435
-
数据库停止
[lightdb@localhost lightdb-dis]$ lt_ctl -D ./data stop
waiting for server to shut down.... done
server stopped
[lightdb@localhost lightdb-dis]$
[lightdb@localhost lightdb-dis]$ lt_ctl -D ./data1 stop
waiting for server to shut down.... done
server stopped
[lightdb@localhost lightdb-dis]$ lt_ctl -D ./data2 stop
waiting for server to shut down.... done
server stopped