AntDB安装扩展UUID和中文全文检索及部署

快速安装AntDB

安装扩展UUID和中文全文检索

源码安装ADB manager

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
获取源码(也可以直接下载源码zip包):
git clone https://github.com/ADBSQL/AntDB -b ADB3_1_STABLE

3.1.1标签版本对一些扩展支持的不是太好(具体没说明),这里选择的是正式版3.1

  • step 1: mkdir build
  • step 2: cd build
  • step 3: …/AntDB/configure --prefix=/opt/adbsql --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"
如果安装了UUID依赖 configure 参数需要添加:–with-ossp-uuid 添加uuid扩展

…/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 4: make install-world-contrib-recurse

step 1步骤中,由于用同一份代码生成了mgr,agtm,所以需要在源码的同级目录下单独创建build编译目录;

step 2步骤中,–prefix目录为准备安装的目录,可以根据需求灵活设置。

初始化ADB manager:

新建一个普通的用户:adb(或者使用已有的普通用户),初始化ADB manager。 编译ADB manager之后,会在指定的目录的bin目录下产生initmgr和mgr_ctl可执行文件。

配置PATH变量 vi /etc/profile 追加,source生效:
export ADBHOME=/opt/adbsql 
export PATH=$ADBHOME/bin:$PATH
export LD_LIBRARY_PATH=$ADBHOME/lib:$LD_LIBRARY_PATH
执行下面命令开始初始化ADB manager:

initmgr -D ./data/adb/mgr

路径是希望初始化到哪

启动 ADB manager:

两种启动方式:
mgr_ctl start -D ./data/adb/mgr
adbmgrd -D ./data/adb/mgr &
搭建 ADB 集群

登陆到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:

一次启动全部agentstart agent all password ‘dpnice’;
启动指定的agentstart 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:自定义端口

配置节点参数:
先略过

init all启动集群:

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&A:

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
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值