安装扩展UUID和中文全文检索
ADB manager与ADB 集群的源码绑定在一起,所以编译ADB manager,就是编译ADB 集群的源码。
yum install -y perl-ExtUtils-Embed
yum install -y flex
yum install -y bison
yum install -y readline-devel
yum install -y zlib-devel
yum install -y openssl-devel
yum install -y pam-devel
yum install -y libxml2-devel
yum install -y libxslt-devel
yum install -y openldap-devel
yum install -y python-devel
yum install -y gcc-c++
yum install -y libssh2-devel
git clone https://github.com/ADBSQL/AntDB -b ADB3_1_STABLE
3.1.1标签版本对一些扩展支持的不是太好(具体没说明),这里选择的是正式版3.1
…/antdb/configure --prefix=/home/dpnice/Public/adbsql --with-ossp-uuid --with-perl --with-python --with-openssl --with-pam --with-ldap --with-libxml --with-libxslt --enable-thread-safety --enable-debug --enable-cassert CFLAGS="-DWAL_DEBUG -O2 -ggdb3 -fsigned-char"
step 1步骤中,由于用同一份代码生成了mgr,agtm,所以需要在源码的同级目录下单独创建build编译目录;
step 2步骤中,–prefix目录为准备安装的目录,可以根据需求灵活设置。
新建一个普通的用户:adb(或者使用已有的普通用户),初始化ADB manager。 编译ADB manager之后,会在指定的目录的bin目录下产生initmgr和mgr_ctl可执行文件。
export ADBHOME=/opt/adbsql
export PATH=$ADBHOME/bin:$PATH
export LD_LIBRARY_PATH=$ADBHOME/lib:$LD_LIBRARY_PATH
initmgr -D ./data/adb/mgr
路径是希望初始化到哪
两种启动方式:
mgr_ctl start -D ./data/adb/mgr
adbmgrd -D ./data/adb/mgr &
登陆到ADBmanger命令:
psql -d postgres -p 6432
添加主机(host):
add host localhost1(port=22,protocol='ssh',adbhome='/home/dpnice/Public/adbsql',address="10.1.226.201",agentport=8432,user='dpnice');
add host localhost2(port=22,protocol='ssh',adbhome='/home/dpnice/Public/adbsql',address="10.1.226.202",agentport=8432,user='dpnice');
add host localhost3(port=22,protocol='ssh',adbhome='/home/dpnice/Public/adbsql',address="10.1.226.203",agentport=8432,user='dpnice');
deploy二进制程序:
一次部署所有主机 | deploy all password ‘dpnice’; |
---|---|
部署指定的主机 | deploy cdh1,cdh2 password ‘dpnice’; |
启动agent:
一次启动全部agent | start agent all password ‘dpnice’; |
---|---|
启动指定的agent | start agent localhost1/localhost2 password ‘dpncie’; |
注:密码是linux密码
配置集群节点:
add coordinator master coord0(path = '/data/adb/adb_data/coord/0', host='localhost1', port=4332);
add coordinator master coord1(path = '/data/adb/adb_data/coord/1', host='localhost2', port=4332);
add datanode master datanode0(path = '/data/adb/adb_data/datanode/0', host='localhost1', port=14332);
add datanode slave datanode0s for datanode0(host='localhost2',port=14332,path='/data/adb/adb_data/datanode/00');
add datanode master datanode1(path = '/data/adb/adb_data/datanode/1', host='localhost2', port=24332);
add datanode slave datanode1s for datanode1(host='localhost1',port=24332,path='/data/adb/adb_data/datanode/11');
add gtm master gtm(host='localhost3',port=6655, path='/data/adb/adb_data/gtm');
add gtm slave gtms for gtm(host='localhost2',port=6655,path='/data/adb/adb_data/gtm_slave');
path:自定义路径 host:ip地址 port:自定义端口
配置节点参数:
先略过
postgres=# init all;
正常启动mode:START ALL;
关闭stop all 或者 stop all mode fast;
查看集群各个节点的运行状态:
monitor all;
安装UUID的相关依赖:
yum install -y uuid*
安装中文全文检索分词 zhparser:
zhparser 是一个支持中文全文检索的 extension,基于Simple Chinese Word Segmentation(SCWS) 上开发的参考单PostgreSQL的的使用方式,插件的编译安装,没有额外的设置
1.SCWS安装
下载文件:
http://www.xunsearch.com/scws/down/scws-1.2.2.tar.bz2
解压:
tar xvf scws-1.2.2.tar.bz2
安装:
cd scws-1.2.2
./configure
make install
2.zhparser安装
下载zhparser:
https://github.com/amutu/zhparser/archive/master.zip
解压:
unzip zhparser-master.zip
进入解压目录执行命令:
SCWS_HOME=/usr/local make && make install
1、创建extension:create extension zhparser;
2、CREATE TEXT SEARCH CONFIGURATION testzhcfg (PARSER = zhparser);
3、ALTER TEXT SEARCH CONFIGURATION testzhcfg ADD MAPPING FOR n,v,a,i,e,l WITH simple;
4、select to_tsvector(‘testzhcfg’,‘南京市长江大桥’);
查看是否安装解压成功命令:ll ./adbsql/share/postgresql/extension/
创建uuid扩展:create extension “uuid-ossp”;
查看所有扩展:select * from pg_extension;
F:
DETAIL: ERROR: could not load library “/home/dpnice/Public/adbsql/lib/postgresql/zhparser.so”: libscws.so.1: cannot open shared object file: No such file or directory
A:每台Datanode 都得有扩展的依赖, ldd命令查看文件是否正确,
正确的示例:
注:安装新的扩展需关闭mode 关闭 agent 重新 deploy all password ‘dpnice’;
参考:
https://my.oschina.net/yafeishi/blog/1858067
https://blog.csdn.net/rocklee/article/details/81317144
ADBSQL docs:
https://github.com/ADBSQL/docs/blob/master/AntDB/how-to-install-AntDB.md