AntDB上使用uuid

安装uuid相关依赖
sudo yum install -y uuid*
停止集群
adbmgr 进入:
stop all mode fast;
stop agent all;
重新编译antdb
 ../antdb/configure --prefix=/home/adb/antdb/app --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"

make install-world-contrib-recurse  

configure 参数需要添加:–with-ossp-uuid

在adbhome下查找uuid相关文件
[adb@bogon ~]$ find antdb/app -name 'uuid*'
antdb/app/lib/postgresql/uuid-ossp.so
antdb/app/share/postgresql/extension/uuid-ossp--1.1.sql
antdb/app/share/postgresql/extension/uuid-ossp--unpackaged--1.0.sql
antdb/app/share/postgresql/extension/uuid-ossp.control
antdb/app/share/postgresql/extension/uuid-ossp--1.0--1.1.sql
antdb/app/include/postgresql/server/utils/uuid.h
[adb@bogon ~]$ 
启动antdb集群
adbmgr 进入:
deploy all;
start agent all;
start all;

记得要进行deploy,保证各个主机上的adbhome下都有uuid相关文件

创建uuid扩展
postgres=# create extension "uuid-ossp";
CREATE EXTENSION
postgres=# select * from pg_extension ;
  extname  | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition 
-----------+----------+--------------+----------------+------------+-----------+--------------
 plpgsql   |       10 |           11 | f              | 1.0        |           | 
 uuid-ossp |       10 |         2200 | t              | 1.1        |           | 
(2 rows)

uuid已经安装成功。

查看uuid相关函数
postgres=# \df uuid_*
                                    List of functions
   Schema   |        Name        | Result data type |    Argument data types    |  Type  
------------+--------------------+------------------+---------------------------+--------
 pg_catalog | uuid_cmp           | integer          | uuid, uuid                | normal
 pg_catalog | uuid_eq            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_ge            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_gt            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_hash          | integer          | uuid                      | normal
 pg_catalog | uuid_in            | uuid             | cstring                   | normal
 pg_catalog | uuid_le            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_lt            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_ne            | boolean          | uuid, uuid                | normal
 pg_catalog | uuid_out           | cstring          | uuid                      | normal
 pg_catalog | uuid_recv          | uuid             | internal                  | normal
 pg_catalog | uuid_send          | bytea            | uuid                      | normal
 pg_catalog | uuid_sortsupport   | void             | internal                  | normal
 public     | uuid_generate_v1   | uuid             |                           | normal
 public     | uuid_generate_v1mc | uuid             |                           | normal
 public     | uuid_generate_v3   | uuid             | namespace uuid, name text | normal
 public     | uuid_generate_v4   | uuid             |                           | normal
 public     | uuid_generate_v5   | uuid             | namespace uuid, name text | normal
 public     | uuid_nil           | uuid             |                           | normal
 public     | uuid_ns_dns        | uuid             |                           | normal
 public     | uuid_ns_oid        | uuid             |                           | normal
 public     | uuid_ns_url        | uuid             |                           | normal
 public     | uuid_ns_x500       | uuid             |                           | normal
(23 rows)

postgres=# select uuid_generate_v1();
           uuid_generate_v1           
--------------------------------------
 81eca584-8985-11e8-b2f3-080027cbfd68
(1 row)

猜你喜欢

转载自blog.csdn.net/yafeishi_cs/article/details/81080031