1. 程式人生 > >AntDB安裝擴充套件UUID和中文全文檢索及部署

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:

一次啟動全部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:自定義埠

配置節點引數:
先略過

init all啟動叢集:


postgres=# init all;

檢視叢集各個節點的執行狀態:

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/

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