Otu esi etinye PostgreSQL 10 Iji Code Source na Linux


PostgreSQL nke a na-akpọ Postgres bụ usoro nchekwa data dị ike na nke mepere emepe. Ọ bụ nchekwa data ọkwa ụlọ ọrụ nwere atụmatụ dị ka dee n'ihu ịdebanye aha maka nnabata mmejọ, mmegharị asynchronous, Multi-Version Concurrency Control (MVCC), ntanetị/nchekwa dị ọkụ, na-atụnye oge mgbake, onye na-eme atụmatụ/onye na-ebuli elu, oghere tebụl, azụmahịa akwụghị ụgwọ (ebe nchekwa. ) wdg.

Postgres nwere ụdị 10 kachasị ọhụrụ ewepụtara na 5th Ọkt 2017 site na postgres otu mmepe ụwa niile.

Njirimara nke ụdị ọhụrụ bụ ndị a:

  • Ntugharị ezi uche: Njirimara a na-enyere aka ngbanwe nke ihe nchekwa data ọ bụla (ma ọ bụrụ ahịrị, tebụl, ma ọ bụ ọdụ data nhọrọ) n'ofe sava nọrọ njikere. Ọ na-enye njikwa karịa n'ịkwagharị data. Emebere ya site na iji ụdị onye nbipute-onye debanyere aha.
  • Quorum Commit for Synchronous Replication: N'ime njirimara a, dba nwere ike ịkọwapụta ọnụọgụ njikere ugbu a na mgbanwe na nchekwa data emeela, ka e wee were were dee data n'enweghị nsogbu.
  • Nnwale SCRAM-SHA-256: Nchekwa emelitere nke nyocha na nchekwa paswọọdụ dabere na MD5 dị.
  • Mmechapụ ajụjụ myirịta.
  • nkewa tebụl nkwuputa.
  • Nkwado ọchụchọ ederede zuru ezu maka JSON na JSONB.

N'isiokwu a, anyị ga-akọwa otu esi etinye PostgreSQL 10 site na iji ntinye koodu isi na sistemụ Linux. Ndị na-achọ nrụnye dị mfe site na njikwa ngwugwu nkesa ha nwere ike soro ntuziaka ndị a n'okpuru.

  1. Etu esi etinye PostgreSQL 10 na CentOS/RHEL na Fedora
  2. Otu esi etinye PostgreSQL 10 na Debian na Ubuntu

Wụnye PostgreSQL Iji Koodu Isi mmalite

Dị ka postgres bụ nchekwa data mepere emepe, enwere ike wulite ya site na koodu isi mmalite dịka mkpa/ihe mmadụ chọrọ si dị. anyị nwere ike hazie usoro nrụpụta na nwụnye site na ịnye otu nhọrọ ahịrị iwu ma ọ bụ karịa maka atụmatụ ndị ọzọ dị iche iche.

Isi uru nke iji ntinye koodu ntinye bụ enwere ike ịhazi ya nke ukwuu n'oge echichi.

1. Buru ụzọ tinye ihe achọrọ dị ka gcc, readline-devel na zlib-devel site na iji njikwa ngwugwu dị ka egosiri.

# yum install gcc zlib-devel readline-devel     [On RHEL/CentOS]
# apt install gcc zlib1g-dev libreadline6-dev   [On Debian/Ubuntu]

2. Budata faịlụ tar koodu isi sitere na iwu wget gọọmentị ozugbo na sistemụ.

# wget https://ftp.postgresql.org/pub/source/v10.0/postgresql-10.0.tar.bz2

3. Jiri iwu tar wepụ faịlụ tarball ebudatara. A ga-emepụta ndekọ ọhụrụ aha ya bụ postgresql-10.0.

# tar -xvf postgresql-10.0.tar.bz2
# ll
total 19236
-rw-------. 1 root root      933 Mar 18  2015 anaconda-ks.cfg
-rw-r--r--. 1 root root     8823 Mar 18  2015 install.log
-rw-r--r--. 1 root root     3384 Mar 18  2015 install.log.syslog
drwxrwxrwx  6 1107 1107     4096 Oct  3  2017 postgresql-10.0
-rw-r--r--  1 root root 19639147 Oct  3  2017 postgresql-10.0.tar.bz2

4. Nzọụkwụ ọzọ maka usoro ntinye bụ ịhazi koodu isi iyi ebudatara site na ịhọrọ nhọrọ dịka mkpa gị si dị.

# cd postgresql-10.0

jiri ./configure --help nweta enyemaka gbasara nhọrọ dị iche iche.

# ./configure --help

Defaults for the options are specified in brackets.
Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local/pgsql]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

5. Ugbu a mepụta ndekọ ebe ịchọrọ ịwụnye faịlụ postgres ma jiri nhọrọ prefix na nhazi.

# mkdir /opt/PostgreSQL-10/
# ./configure --prefix=/opt/PostgreSQL-10
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc supports -Wdeclaration-after-statement... yes
checking whether gcc supports -Wendif-labels... yes
checking whether gcc supports -Wmissing-format-attribute... yes
checking whether gcc supports -Wformat-security... yes
checking whether gcc supports -fno-strict-aliasing... yes
checking whether gcc supports -fwrapv... yes
checking whether gcc supports -fexcess-precision=standard... no
....

6. Mgbe configuring, ọzọ anyị ga-amalite na-ewu postgreSQL iji na-esonụ ime iwu.

# make

Mgbe usoro wuchara, ugbu a wụnye postgresql site na iji iwu a.

# make install

E tinyela Postgresql 10 na /opt/PostgreSQL-10 ndekọ.

7. Ugbu a mepụta onye ọrụ postgres na ndekọ ka a ga-eji dị ka ndekọ data maka ịmalite ụyọkọ nchekwa data. Onye nwe ndekọ data a kwesịrị ịbụ onye ọrụ postgres na ikike kwesịrị ịbụ 700 ma debekwa ụzọ maka ọnụọgụ abụọ postgresql maka ịdị mfe anyị.

# useradd postgres
# passwd postgres
# mkdir /pgdatabase/data
# chown -R postgres. /pgdatabase/data
# echo 'export PATH=$PATH:/opt/PostgreSQL-10/bin' > /etc/profile.d/postgres.sh

8. Ugbu a bido nchekwa data site na iji iwu a dị ka onye ọrụ postgres tupu iji iwu postgres ọ bụla.

# su postgres
$ initdb -D /pgdatabase/data/ -U postgres -W

Ebe -D bụ ọnọdụ maka ụyọkọ nchekwa data a ma ọ bụ anyị nwere ike ịsị na ọ bụ ndekọ data ebe anyị chọrọ ibido ụyọkọ nchekwa data, -U maka aha superuser nchekwa data na - W maka okwu mbanye maka db superuser.

Maka ozi ndị ọzọ na nhọrọ anyị nwere ike zoo aka initdb -help.

9. Mgbe ịmalite nchekwa data, malite ụyọkọ nchekwa data ma ọ bụ ọ bụrụ na ịchọrọ ịgbanwe ọdụ ụgbọ mmiri ma ọ bụ gee adreesị maka ihe nkesa, dezie faịlụ postgresql.conf na ndekọ data nke ihe nkesa nchekwa data.

$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log start

10. Mgbe ịmalitere nchekwa data, nyochaa ọkwa nke usoro ihe nkesa postgres site na iji iwu.

$ ps -ef |grep -i postgres
$ netstat -apn |grep -i 51751

Anyị nwere ike ịhụ na ụyọkọ nchekwa data na-aga nke ọma, enwere ike ịhụ ndekọ mmalite na ọnọdụ akọwapụtara na nhọrọ -l mgbe ị na-amalite ụyọkọ nchekwa data.

11. Ugbu a jikọọ na ụyọkọ nchekwa data wee mepụta nchekwa data site na iji iwu.

$ psql -p 51751
postgres=# create database test;
postgres=# \l to list all databases in cluster
postgres=# \q to quit form postgres console

Ọ bụ ya! N'ime edemede anyị na-abịa, m ga-ekpuchi nhazi, nhazigharị na ntinye nke ngwa pgAdmin, ruo mgbe ahụ nọrọ na nche na Tecmint.