Postgresql數據庫安裝中文全文搜索插件zhparser的問題

在PG數據庫的基礎上加裝zhparser中文全文搜索插件,說實話,挺怕這些單獨編譯安裝的插件的,由於安裝PG數據庫方法的不一樣,最後可能致使安裝的插件各類安裝不上,這裏說一下我遇到的坑,系統環境是Centos7, yum安裝的PG9.6。git

#一、INSTALL 關於安裝方法,能夠直接到上面看https://github.com/amutu/zhparsergithub

#二、make的時候缺乏pgxs.mksql

[root@az zhparser]# PG_CONFIG=/usr/pgsql-9.6/bin/pg_config make && make install
Makefile:19: /usr/pgsql-9.6/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target `/usr/pgsql-9.6/lib/pgxs/src/makefiles/pgxs.mk'.  Stop.

解決方法:數據庫

[root@az zhparser]# export PATH=/usr/pgsql-9.6/bin:$PATH
[root@az zhparser]# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
[root@az zhparser]# yum install postgresql96-devel.x86_64

#三、建立zhparser的時候提示Permission deniedcentos

ERROR:  could not open file "/usr/pgsql-9.6/share/tsearch_data/qc_dict_jupiter.txt" for writing: Permission denied
HINT:  COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy.
CONTEXT:  SQL statement "copy (select word, tf, idf, attr from zhparser.zhprs_custom_word) to '/usr/pgsql-9.6/share/tsearch_data/qc_dict_jupiter.txt' encoding 'utf8'"
PL/pgSQL function sync_zhprs_custom_word() line 11 at EXECUTE

解決方法:ide

chown -R postgres:postgres /usr/pgsql-9.6/share/tsearch_data/

#四、ERROR:  must be superuser to alter superuserspost

[root@az data]# sudo -u postgres /usr/pgsql-9.6/bin/postgres --single -D /var/lib/pgsql/9.6/data/
PostgreSQL stand-alone backend 9.6
backend> ALTER USER postgres WITH SUPERUSER;
backend>
相關文章
相關標籤/搜索