主要目的比较简单,就是测试下yugabyte 对于pg 扩展的支持,今天在测试plv8的时候发现有问题(以及提交issue了,很期待官方的解决)
所以测试下一个其他的扩展,看看是否像官方介绍的那样

环境准备

  • 说明
    环境基于docker 运行,同时pg_hashids 扩展也基于docker 构建,之后copy yugabyte 扩展安装目录
  • pg_hashids dockerfile
 
FROM postgres:11.2
ENV PG_HASHIDS=v1.2.1
LABEL EMAIL="1141591465@qq.com"
LABEL AUTHOR="dalongrong"
RUN buildDependencies="curl build-essential ca-certificates git pkg-config postgresql-server-dev-$PG_MAJOR" \
  && apt-get update \
  && apt-get install -y --no-install-recommends libc++1 ${buildDependencies} \
  && mkdir -p /tmp/build \
  && cd /tmp/build \
  && git clone https://github.com/iCyberon/pg_hashids.git /tmp/build/pg_hashids \
  && cd /tmp/build/pg_hashids \
  && make && make install \
  && cd / \
  && apt-get clean \
  && apt-get remove -y ${buildDependencies} \
  && apt-get autoremove -y \
  && rm -rf /tmp/build /var/lib/apt/lists/*
  • yugabyte 集群
    基于docker-compose 运行
 
version: '2'
services:
  yb-master:
      image: yugabytedb/yugabyte:latest
      container_name: yb-master-n1
      command: [ "/home/yugabyte/bin/yb-master", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1", 
                "--master_addresses=yb-master-n1:7100", 
                "--replication_factor=1"]
      ports:
      - "7000:7000"
      environment:
        SERVICE_7000_NAME: yb-master
  yb-tserver:
      image: yugabytedb/yugabyte:latest
      container_name: yb-tserver-n1
      command: [ "/home/yugabyte/bin/yb-tserver", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",
                "--start_pgsql_proxy", 
                "--tserver_master_addrs=yb-master-n1:7100"]
      ports:
      - "9042:9042"
      - "6379:6379"
      - "5433:5433"
      - "9000:9000"
      environment:
        SERVICE_5433_NAME: ysql
        SERVICE_9042_NAME: ycql
        SERVICE_6379_NAME: yedis
        SERVICE_9000_NAME: yb-tserver
      depends_on:
      - yb-master
  yb-tserver2:
      image: yugabytedb/yugabyte:latest
      container_name: yb-tserver-n2
      command: [ "/home/yugabyte/bin/yb-tserver", 
                "--fs_data_dirs=/mnt/disk0,/mnt/disk1",
                "--start_pgsql_proxy", 
                "--tserver_master_addrs=yb-master-n1:7100"]
      ports:
      - "9043:9042"
      - "6380:6379"
      - "5434:5433"
      - "9001:9000"
      environment:
        SERVICE_5433_NAME: ysql
        SERVICE_9042_NAME: ycql
        SERVICE_6379_NAME: yedis
        SERVICE_9000_NAME: yb-tserver
      depends_on:
      - yb-master

启动&&扩展copy

  • 启动服务
docker-compose up -d
  • 启用ysql

    新版本的好像默认,就启用了,后边在仔细测试下

docker-compose exec yb-master bash -c "YB_ENABLED_IN_POSTGRES=1 FLAGS_pggate_master_addresses=yb-master-n1:7100 /home/yugabyte/postgres/bin/initdb -D /tmp/yb_pg_initdb_tmp_data_dir -U postgres"
  • copy 扩展

    为了测试,我已经copy 出构建好的扩展到本地

docker cp hashids/pg_hashids.so yb-tserver-n1:/home/yugabyte/postgres/lib
docker cp hashids/pg_hashids.so yb-tserver-n2:/home/yugabyte/postgres/lib
docker cp hashids/extension/. yb-tserver-n1:/home/yugabyte/postgres/share/extension
docker cp hashids/extension/. yb-tserver-n2:/home/yugabyte/postgres/share/extension

扩展测试

  • 启动扩展
CREATE EXTENSION pg_hashids;
  • 调用函数
SELECT id_encode(1001);
  • 效果

参考资料

https://github.com/iCyberon/pg_hashids
https://github.com/rongfengliang/yugabytedb-jaeger-docker-compose
https://github.com/rongfengliang/pg_hashids_docker
https://docs.yugabyte.com/latest/api/ysql/extensions/
https://hashids.org/

yugabyte 安装pg_hashids 扩展的更多相关文章

  1. pecl 轻松安装php扩展

    PECL 的全称是 The PHP Extension Community Library ,是一个开放的并通过 PEAR(PHP Extension and Application Reposito ...

  2. 编译安装PHP7并安装Redis扩展Swoole扩展

    编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机器上已经有编译安装过php5.3以上的版本,从而依赖库都有了 本php7是编译成fpm-php 使用的, 如果是apache那么 ...

  3. 使用phpize安装php扩展

    环境: CentOs 6.3 php 7 nginx 举例: 安装ssh2扩展 1.登陆http://pecl.php.net,搜索ssh2,如下图所示,注意版本的选择要根据php的版本来 2.下载s ...

  4. centos下安装php扩展php-memcached

    说来坎坷,为了安装这个php的扩展php-memcached,连操作系统都换了,从centos5.5升级到了centos6.8!! centos5.5中在安装php扩展php-memcached的依赖 ...

  5. 如何正确使用 Composer 安装 Laravel 扩展包

    我们经常要往现有的项目中添加扩展包,有时候因为文档的错误引导,如下图来自 这个文档 的: composer update 这个命令在我们现在的逻辑中,可能会对项目造成巨大伤害. 因为 composer ...

  6. win10 64位安装memcache扩展和开启redis扩展

    前面有关于win10下搭建wamp环境的介绍,在此不在赘述,php操作memcache有memcache库和memcached库,其中memcache是php内置的扩展库,支持面向对象和面向过程两种操 ...

  7. Linux下,如何给PHP安装pdo_mysql扩展

    下载了一个免费开源的广告系统(openadserver),在Linux上安装时,提示要安装 pdo_mysql 扩展,先前有过编译安装 soap扩展 的经历,今天要编译安装 pdo_mysql 扩展, ...

  8. [Linux][PHP]安装swoole扩展

    1.下载swoole 2.解压并配置 /usr/local/php/bin/phpize ./configure --enable-swoole-debug --enable-sockets --en ...

  9. lnmp---------------lnmp1.3-full安装包安装lnmp环境,如何安装PHP扩展

    1. 如果已经安装LNMP套件,请按以下步骤处理 a. 跳转到fileinfo源代码目录` cd /root/downloads/lnmp1.2-full/src/php-7.0.7/ext/file ...

随机推荐

  1. Debug 路漫漫-11:Python: TypeError: 'generator' object is not subscriptable

    调试程序,出现以下错误: Python: TypeError: 'generator' object is not subscriptable “在Python中,这种一边循环一边计算的机制,称为生成 ...

  2. 在linux上安装taiga

    # taiga 安装配置 1.简介 本文档介绍了如何部署完整的Taiga服务(每个模块都是Taiga平台的一部分). Taiga平台由三个主要组件组成,每个组件在编译时和运行时都有自己的依赖关系: t ...

  3. QT 随笔目录

    [1]基础部分 <信号和槽机制> <信号与槽知识点> <QString 与 string转换> <QT 继承QWidget && 继承QDia ...

  4. 在 ubuntu 下安装 mono 和 xsp4 ,并测试

    1. 安装完 ubuntu 后,在 ubuntu 软件中查看是否自带了 mono 运行时和 XSP4,如果没有,则选中后,点击安装按钮. 2. 安装完后,在终端(类似于 Windows 上的命令行工具 ...

  5. 剑指Offer_栈的压入序列是否有对应的弹出序列

    题目: 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序. 如:假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是 ...

  6. NetCoreApi框架搭建三、JWT授权验证)

    1.首先还是粘贴大神的链接 虽然说大神的博客已经讲得很详细了,但是此处还是自己动手好点. 首先配置Startup Swagger的验证 2.新建一个项目存放tokenmodel和生成token并且存入 ...

  7. tkinter的trace()变动追踪

    tkinter的trace() 的参数w是写入追踪 from tkinter import * def callback(*args): xl.set(xE.get()) print("改变 ...

  8. python 学习之 基础篇二 字符编码

    声明: 博文参考1:字符编码发展历程(ASCII,Unicode,UTF-8) 博文参考2:Python常见字符编码间的转换 (1)为什么要用字符编码 早期的计算机使用的是通电与否的特性的真空管,如果 ...

  9. 【团队项目1】 团队展示&选题

    一.团队展示 1. 队名:这次稳了 2. 队员: 莫少政 3117004667 (队长) 黄思扬 3117004657 余泽端 3117004679 江海灵 3117004658 温治乾 311700 ...

  10. 剑指:求1+2+…+n

    题目描述 求 1+2+…+n,要求不能使用 乘除法.for.while.if.else.switch.case 等关键字及条件判断语句 A?B:C. 样例 输入:10 输出:55 解法 前面的和+后一 ...