1. Purpose
- AgensGraph is multi-database(RDB+GDB). It is database in NoSQL area . I usually had used the Relational-Database(Oracle, MySQL) for SQL.
- To exercise NoSQL.
- Foreign Data Wrapper(FDW) is extensional skill in PostgreSQL.
- AgensGraph based on PostgreSQL.
- Studying with React, Python.
- For me. Using the MongoFDW(enterprise-DB/MongoFDW) setting is too hard. So editing
- chapter 1 page is installation guide. AgensGraph, MongoDB, MongoFDW
- chapter 2 page is foreign table SELECT, and data visualization
- chapter 3 page is data visualization MongoDB->AgensGraph->Frontend
1-1. Next Posting
- MongoFDW to AgensGraph data for visualization 2 to 3
- MongoFDW to AgensGraph data for visualization 3 to 3
- OracleFDW to AgensGraph data for visualization
2. Install
environment
- Docker image CentOS 7 ↑
* docker images empty library and very cleanning environment.
2-1. BASIC SETTING!
- sudoers user creating
- super user auth group is wheel. therefore user modified group to wheel.
useradd test passwd test usermod -aG wheel test
- Using to YUM repository, and packaging install
yum install sudo wget git make unzip gcc glibc glib-common readline readline-devel zlib zlib-devel flex bison python-devel -y
- test user connection
su - test
2-2. AgensGraph installation
- add
git clone https://github.com/bitnine-oss/agensgraph.git
- c file compile and make
./configure --prefix=$HOME/agraph (optional -> --with-python(for plpythonu)... --with-ssl) -> ./configure --prefix=$HOME/agraph --with-python make && make install-world (-world keyword is fuzzystrmatch extension, and etc...)
- AgensGraph(ps A.G) environment variables setting
vi ~/.bashrc export AGHOME=$HOME/agraph export PATH=$AGHOME/bin:$PATH export LD_LIBRARY_PATH=$AGHOME/lib:$LD_LIBLIRARY_PATH export AGDATA=$HOME/db_cluster export LANG=en_US.utf8 export PGPORT=5555 export PGUSER=test
- bashrc injection
source ~/.bashrc or . .bashrc
- initialize DB cluster
- DB locale is dependent on OS locale.
initdb
- A.G start
ag_ctl start
- A.G DB creating
- initialized user name(PostgreSQL role)
createdb
- DB console connect(equals psql)
agens
if under screenshot is displayed, you success AgensGraph installation. —-
2-3. MongoDB installation
-
if you MongoDB was known Graph Database, you wrong. MongoDB is Document database (JSON, BSON)
- MongoDB
MongoServer download and tar unzip
cd $HOME wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.4.tgz tar -xvf mongodb-linux-x86_64-rhel70-4.0.4.tgz mv mongodb-linux-x86_64-rhel70-4.0.4 mongodb
- MongoDB environment setting
vi ~/.bashrc export MONGO_HOME=$HOME/mongodb export PATH=$MONGO_HOME/bin:$PATH
- MongoDB cluster creating
mkdir -p data/db_cluster
- MongoDB starting. (background starting)
mongod --dbpath $MONGO_HOME/data/db_cluster &
- MongoDB select
mongo
- MongoDB collection make and insert document data (JSON)
use test db.createCollection('collection1') db.collection1.insert({"name":"test1"}) db.collection1.insert({"name":"test2"}) db.collection1.insert({"name":"test3"})
2-4. MongoFDW installation
- MongoFDW
- I used enterprisedb/mongofdw
cd $HOME git clone https://github.com/EnterpriseDB/mongo_fdw.git
- MongoFDW environment setting
vi ~/.bashrc export MONGO_FDW_HOME=$HOME/mongo_fdw export PATH=$MONGO_FDW_HOME/json-c:$PATH export PKG_HOME=$MONGO_FDW_HOME/mongo-c-driver export PKG_CONFIG_PATH=$PKG_HOME/src:$PKG_HOME/src/libbson/src:$PKG_CONFIG_PATH export LD_LIBRARY_PATH=/usr/local/lib:$MONGO_FDW_HOME/json-c/.libs:$LD_LIBRARY_PATH
- MongoFDW installation
cd $HOME/mongo_fdw sudo sh autogen.sh --with-master
- MongoFDW file changing owner
sudo chown -R test:test mongo_fdw/
- MongoFDW compile
make && make install
- if ‘make’ not executed, editing to ‘Makefile’ add to
$(LIBJSON)/strerror_override.o