zombodb是一个强大的pg扩展,我们可以像操作数据库一样操作es,以下是pgspider与zombodb的构建说明,使用最新版本v5.6.16-1.0.20构建失败,使用了v. zombodb 是一个强大的pg 扩展,我们可以像操
zombodb 是一个强大的pg 扩展,我们可以像操作数据库一样操作es,以下是pgspider 与zombodb 的构建
说明,使用最新版本v5.6.16-1.0.20 构建失败,使用了v.40
dockerfile
老样子基于已经构建好的pgspider base 镜像
FROM dalongrong/pgspider:base as buildWORKDIR /appRUN apt-get update \ groupadd -r postgres --gid=999; \# https://salsa.debian.org/postgresql/postgresql-common/blob/997d842ee744687d99a2b2d95c1083a2615c79e8/debian/postgresql-common.postinst#L32-35 useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \# also create the postgres user‘s home directory with appropriate permissions# see https://github.com/docker-library/postgres/issues/274 mkdir -p /var/lib/postgresql; \ chown -R postgres:postgres /var/lib/postgresql?RUN wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ \ if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ # if this file exists, we‘re likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales) grep -q ‘/usr/share/locale‘ /etc/dpkg/dpkg.cfg.d/docker; \ sed -ri ‘/\/usr\/share\/locale/d‘ /etc/dpkg/dpkg.cfg.d/docker; \ ! grep -q ‘/usr/share/locale‘ /etc/dpkg/dpkg.cfg.d/docker; \ fi; \ apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8ENV LANG en_US.utf8?# install "nss_wrapper" in case we need to fake "/etc/passwd" and "/etc/group" (especially for OpenShift)# https://github.com/docker-library/postgres/issues/359# https://cwrap.org/nss_wrapper.htmlRUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends libnss-wrapper; \ rm -rf /var/lib/apt/lists/*?RUN mkdir /docker-entrypoint-initdb.dCOPY --from=build /usr/local/pgspider /usr/local/pgspiderRUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = ‘*‘!" /usr/local/pgspider/share/postgresql/postgresql.conf.sample; \ grep -F "listen_addresses = ‘*‘" /usr/local/pgspider/share/postgresql/postgresql.conf.sampleRUN mkdir -p /var/run/postgresql CREATE TABLE products ( id SERIAL8 NOT NULL PRIMARY KEY, name text NOT NULL, keywords varchar(64)[], short_summary text, long_description zdb.fulltext, price bigint, inventory_count integer, discontinued boolean default false, availability_date date);CREATE INDEX idxproducts ON products USING zombodb ((products.*)) WITH (url=‘http://elasticsearch:9200/‘);INSERT INTO "public"."products"("id","name","keywords","short_summary","long_description","price","inventory_count","discontinued","availability_date")VALUES(1,E‘Magical Widget‘,E‘{magical,widget,round}‘,E‘A widget that is quite magical‘,E‘Magical Widgets come from the land of Magicville and are capable of things you can\‘t imagine‘,9900,42,FALSE,E‘2015-08-31‘),(2,E‘Baseball‘,E‘{baseball,sports,round}‘,E‘It\‘s a baseball‘,E‘Throw it at a person with a big wooden stick and hope they don\‘t hit it‘,1249,2,FALSE,E‘2015-08-21‘),(3,E‘Telephone‘,E‘{communication,primitive,"alexander graham bell"}‘,E‘A device to enable long-distance communications‘,E‘Use this to call your friends and family and be annoyed by telemarketers. Long-distance charges may apply‘,1899,200,FALSE,E‘2015-08-11‘),(4,E‘Box‘,E‘{wooden,box,"negative space",square}‘,E‘Just an empty box made of wood‘,E‘A wooden container that will eventually rot away. Put stuff it in (but not a cat).‘,17000,0,TRUE,E‘2015-07-01‘);SELECT * FROM products WHERE products ==> ‘sports box‘;说明
关于pgspider以及zombodb 的我写了一些相关简单文章,可以参考,最好多多看看官方文档
参考资料
https://www.cnblogs.com/rongfengliang/category/1433947.html https://www.cnblogs.com/rongfengliang/category/1641930.html https://hub.docker.com/repository/docker/dalongrong/pgspider https://github.com/rongfengliang/pgspider-docker
pgspider zombodb集成使用