zoukankan      html  css  js  c++  java
  • centos 7.4 + postgresql 10.1 + pg_amqp

    上传 pg_amqp 到 /tmp 目录下

    [root@tpg-1 tmp]# yum install lrzsz 
    [root@tpg-1 tmp]# rz
    
    
    [root@tpg-1 tmp]# ls -l
    -rw-r--r--. 1 root root 48444 Dec 13 11:34 pg_amqp-0.3.0.zip
    
    [root@tpg-1 tmp]# unzip pg_amqp-0.3.0.zip
    [root@tpg-1 tmp]# ls -l
    drwxr-xr-x. 5 root root   109 May 20  2011 pg_amqp-0.3.0
    -rw-r--r--. 1 root root 48444 Dec 13 11:34 pg_amqp-0.3.0.zip

    开始编译

    [root@tpg-1 tmp]# cd pg_amqp-0.3.0
    [root@tpg-1 tmp]# env LDFLAGS="-lpthread" gmake
    
    gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -I. -I./ -I/usr/pgsql-10/include/server -I/usr/pgsql-10/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o src/pg_amqp.o src/pg_amqp.c
    src/pg_amqp.c: In function ‘amqp_local_phase2’:
    src/pg_amqp.c:99:3: warning: enumeration value ‘XACT_EVENT_PARALLEL_COMMIT’ not handled in switch [-Wswitch]
       switch(event) {
       ^
    src/pg_amqp.c:99:3: warning: enumeration value ‘XACT_EVENT_PARALLEL_ABORT’ not handled in switch [-Wswitch]
    src/pg_amqp.c:99:3: warning: enumeration value ‘XACT_EVENT_PRE_COMMIT’ not handled in switch [-Wswitch]
    src/pg_amqp.c:99:3: warning: enumeration value ‘XACT_EVENT_PARALLEL_PRE_COMMIT’ not handled in switch [-Wswitch]
    src/pg_amqp.c:99:3: warning: enumeration value ‘XACT_EVENT_PRE_PREPARE’ not handled in switch [-Wswitch]
    
    
    gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -I. -I./ -I/usr/pgsql-10/include/server -I/usr/pgsql-10/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o src/librabbitmq/amqp_debug.o src/librabbitmq/amqp_debug.c
    src/librabbitmq/amqp_debug.c:44:6: warning: no previous prototype for ‘amqp_dump’ [-Wmissing-prototypes]
     void amqp_dump(void const *buffer, size_t len) {

    存在一些警告,安装过程没有关注,貌似也没啥影响,pg_amqp.so可以正常使用

    [root@tpg-1 tmp]# env LDFLAGS="-lpthread" gmake install

    修改参数

    -bash-4.2$ cat postgresql.conf |grep -i preload
    shared_preload_libraries = 'pg_amqp.so'     # (change requires restart)

    postgresql.conf 的其它参数值依据数据库的作用和机器配置设置

    [root@tpg-1 ~]# systemctl status postgresql-10.service
    [root@tpg-1 ~]# systemctl start postgresql-10.service  
    
    
    -bash-4.2$ psql
     create database testdb;
     l
     c testdb
     select name,default_version,installed_version
     from pg_available_extensions
     where 1=1
     order by name;
    
     create extension amqp;
    
     select *
     from pg_extension;

    参考:
    https://github.com/omniti-labs/pg_amqp
    https://pgxn.org/dist/pg_amqp/
    http://blog.163.com/digoal@126/blog/static/16387704020120182524830

    备注:
    在 centos 7.4 + pgsql9.1 环境编译pg_amqp时,启动pgsql时报下错误,第一个通过德哥的文章解决了,第二步不知道什么原因导致的,先记录下
    FATAL: could not load library “/usr/lib/postgresql/9.1/lib/src/pg_amqp.so”: /usr/lib/postgresql/9.1/lib/src/pg_amqp.so: undefined symbol: pthread_key_create

    FATAL: could not load library “/usr/lib/postgresql/9.1/lib/src/pg_amqp.so”: /usr/lib/postgresql/9.1/lib/src/pg_amqp.so: undefined symbol: pthread_getspecific

  • 相关阅读:
    chmod: changing permissions of ‘/etc/fstab': Read-only file system
    让Mac终端保持(SSH)与远程的连接状态
    修改数据库密码
    SSH密钥登录让Linux VPS/服务器更安全
    redis 使用redis Desktop manger进行远程进行链接
    mysql 性能
    对阿里云服务器(数据盘已分区并格式化)的数据盘进行扩容
    备份数据库的shell
    window上可以执行的shell脚本,复制到linux上执行报错了
    自然语言处理中的N-Gram模型
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793089.html
Copyright © 2011-2022 走看看