This repository provides a tailored version of PostgreSQL used as a Storage Plugin for FogLAMP.
Download a tarball with the prepared version of PostgreSQL available here:
The tarball must be extracted in the git main folder.
This is the download and untar example for the x86 platform:
foglamp@foglamp-dev:~$ wget https://s3.amazonaws.com/foglamp/plugins/storage/postgres/pgsql-foglamp-9.6_201608131-x86_64.tgz --2017-10-10 16:31:41-- https://s3.amazonaws.com/foglamp/plugins/storage/postgres/pgsql-foglamp-9.6_201608131-x86_64.tgz Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.230.125 Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.230.125|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 13512593 (13M) [application/gzip] Saving to: ‘pgsql-foglamp-9.6_201608131-x86_64.tgz’ pgsql-foglamp-9.6_201608131-x86_64.tgz 100%[=====================================================================================>] 12.89M 127KB/s in 4m 18s 2017-10-10 16:35:59 (51.2 KB/s) - ‘pgsql-foglamp-9.6_201608131-x86_64.tgz’ saved [13512593/13512593] foglamp@foglamp-dev:~$ cd storage-postgres/ foglamp@foglamp-dev:~/storage-postgres$ tar xzvf ~/pgsql-foglamp-9.6_201608131-x86_64.tgz pgsql-x86_64/ pgsql-x86_64/share/ ... pgsql-x86_64/lib/libcom_err.so.3 foglamp@foglamp-dev:~/storage-postgres$
There is a script in packages/Debian/bin named make_deb. Once you have downloaded and extracted PostgreSQL for your favorite platform, execute the make_deb script.
foglamp@foglamp-dev:~/storage-postgres$ packages/Debian/bin/make_deb x86 The platform is set as x86_64 The package name is foglamp-storage-postgres-00.01-9.6.201608131-x86_64 Populating the package...Done. Adding FogLAMP customization...Done. Building the new package... dpkg-deb: building package 'foglamp-storage-postgres' in 'foglamp-storage-postgres-00.01-9.6.201608131-x86_64.deb'. Building Complete. foglamp@foglamp-dev:~/storage-postgres$
The working directory and the newly built Debian package are in the packages/Debian/build folder:
foglamp@foglamp-dev:~/storage-postgres$ ls -l packages/Debian/build total 8504 drwxrwxr-x 4 foglamp foglamp 4096 Oct 10 16:48 foglamp-storage-postgres-00.01-9.6.201608131-x86_64 -rw-r--r-- 1 foglamp foglamp 8701188 Oct 10 16:49 foglamp-storage-postgres-00.01-9.6.201608131-x86_64.deb foglamp@foglamp-dev:~/storage-postgres$
Install the PostgreSQL storage layer package as any other Debian package:
foglamp@foglamp-test:~/Downloads$ sudo dpkg -i foglamp-storage-postgres-00.01-9.6.201608131-x86_64.deb (Reading database ... 126439 files and directories currently installed.) Preparing to unpack foglamp-storage-postgres-00.01-9.6.201608131-x86_64.deb ... Unpacking foglamp-storage-postgres (00.01-9.6.201608131) over (00.01-9.6.201608131) ... Setting up foglamp-storage-postgres (00.01-9.6.201608131) ... foglamp@foglamp-test:~/Downloads$
You can check if the packages is already installed and the name of the package with this command:
foglamp@foglamp-test:~/Downloads$ sudo dpkg -l | grep 'foglamp' ii foglamp-storage-postgres 00.01-9.6.201608131 amd64 PostgreSQL Storage Layer Plugin for FogLAMP foglamp@foglamp-test:~/Downloads$
If you want to uninstall the package, use the usual Debian command:
foglamp@foglamp-test:~/Downloads$ sudo dpkg -r foglamp-storage-postgres (Reading database ... 126439 files and directories currently installed.) Removing foglamp-storage-postgres (00.01-9.6.201608131) ... dpkg: warning: while removing foglamp-storage-postgres, directory '/usr/local' not empty so not removed
By default, the database server is installed in the /usr/local/foglamp/plugins/storage/postgres/pgsql. The data directory, containing the system datafile and the socket file, is /usr/local/foglamp/data/storage/postgres
The script /usr/local/foglamp/plugins/storage/postgres/bin/foglamp.postgres is used to administer the database server.
The script executes these functions:
- reset: Reset the Database server. With this command, all the data in the database server will be removed.
- start: Start the Database server
- status: Check the status of the Database server
- stop: Stop the Database server
- restart: Stop and then start the Database server
- help: Show the help page
foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres init This script will remove all data stored in the server. Enter YES if you want to continue: YES FagLAMP PostgreSQL plugin does not appear to be running. Cleaning the Root Data directory... Initializing the Data directory... WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. FogLAMP PostgreSQL plugin reset. foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres status FogLAMP PostgreSQL plugin not running. foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres start waiting for server to start..... done server started Building the metadata for the FogLAMP Plugin... Build completed. foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres status FogLAMP PostgreSQL plugin running. foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres stop waiting for server to shut down.... done server stopped foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres status FogLAMP PostgreSQL plugin not running. foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$ ./foglamp.postgres start waiting for server to start.... done server started foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/bin$
The database is also accessible with the psql command line utility, available in /usr/local/foglamp/plugins/storage/postgres/pgsql/bin.
Please consider the defaults:
- The socket file is in /usr/local/foglamp/data/storage/postgres
- The user foglamp (no password)
- The database is postgres
foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/pgsql/bin$ /usr/local/foglamp/plugins/storage/postgres/bin/foglamp.postgres start waiting for server to start.... done server started foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/pgsql/bin$ ./psql -U foglamp postgres -h /usr/local/foglamp/data/storage/postgres psql.bin (9.6.3) Type "help" for help. Cannot read termcap database; using dumb terminal settings. postgres=# ^D\q foglamp@foglamp-test:/usr/local/foglamp/plugins/storage/postgres/pgsql/bin$
In order to execute psql on ARM, an extra set of libraries must be added to the path:
foglamp@foglamp-dev:~$ LD_LIBRARY_PATH=/usr/local/foglamp/plugins/storage/postgres/pgsql/lib:/usr/local/foglamp/plugins/storage/postgres/pgsql/lib/arm-linux-gnueabihf foglamp@foglamp-dev:~$ export LD_LIBRARY_PATH foglamp@foglamp-dev:~$ /usr/local/foglamp/plugins/storage/postgres/pgsql/bin/psql -h /usr/local/foglamp/data/storage/postgres -U foglamp postgres psql (9.6.3) Type "help" for help. postgres=# \q foglamp@foglamp-dev:~$
This issue will be fixed in the future.