{"id":1386,"date":"2017-04-27T09:07:31","date_gmt":"2017-04-27T01:07:31","guid":{"rendered":"https:\/\/www.strongd.net\/?p=1386"},"modified":"2017-04-27T09:07:31","modified_gmt":"2017-04-27T01:07:31","slug":"postgresql-on-linux-%e6%9c%80%e4%bd%b3%e9%83%a8%e7%bd%b2%e6%89%8b%e5%86%8c","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1386","title":{"rendered":"PostgreSQL on Linux \u6700\u4f73\u90e8\u7f72\u624b\u518c"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\u6570\u636e\u5e93\u7684\u5b89\u88c5\u4e00\u76f4\u4ee5\u6765\u90fd\u633a\u590d\u6742\u7684\uff0c\u7279\u522b\u662fOracle\uff0c\u73b0\u5728\u8eab\u8fb9\u90fd\u8fd8\u6709\u5b89\u88c5Oracle\u6570\u636e\u5e93\u8d5a\u5916\u5feb\u7684\u4e8b\u60c5\u3002<\/p>\n<p>PostgreSQL\u5176\u5b9e\u5b89\u88c5\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u90a3\u4ec5\u4ec5\u662f\u53ef\u7528\uff0c\u5e76\u4e0d\u662f\u597d\u7528\u3002\u5f88\u591a\u7528\u6237\u4f7f\u7528\u9ed8\u8ba4\u7684\u65b9\u6cd5\u5b89\u88c5\u597d\u6570\u636e\u5e93\u4e4b\u540e\uff0c\u7136\u540e\u6d4b\u8bd5\u4e00\u901a\u6027\u80fd\uff0c\u53d1\u73b0\u6027\u80fd\u4e0d\u884c\u5c31\u4e0d\u7528\u4e86\u3002<\/p>\n<p>\u539f\u56e0\u4e0d\u7528\u8bf4\uff0c\u591a\u65b9\u9762\u6ca1\u6709\u4f18\u5316\u7684\u7ed3\u679c\u3002<\/p>\n<p>PostgreSQL\u6570\u636e\u5e93\u4e3a\u4e86\u9002\u5e94\u66f4\u591a\u7684\u573a\u666f\u80fd\u4f7f\u7528\uff0c\u9ed8\u8ba4\u7684\u53c2\u6570\u90fd\u8bbe\u5f97\u975e\u5e38\u4fdd\u5b88\uff0c\u901a\u5e38\u9700\u8981\u4f18\u5316\uff0c\u6bd4\u5982\u68c0\u67e5\u70b9\uff0cSHARED BUFFER\u7b49\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u4e0bPostgreSQL on Linux\u7684\u6700\u4f73\u90e8\u7f72\u65b9\u6cd5\uff0c\u5176\u5b9e\u5728\u6211\u7684\u5f88\u591a\u6587\u7ae0\u4e2d\u90fd\u6709\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u4f46\u662f\u6ca1\u6709\u603b\u7ed3\u6210\u4e00\u7bc7\u6587\u6863\u3002<\/p>\n<h2><a id=\"user-content-os\u4e0e\u786c\u4ef6\u8ba4\u8bc1\u68c0\u67e5\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#os%E4%B8%8E%E7%A1%AC%E4%BB%B6%E8%AE%A4%E8%AF%81%E6%A3%80%E6%9F%A5\"><\/a>OS\u4e0e\u786c\u4ef6\u8ba4\u8bc1\u68c0\u67e5<\/h2>\n<p>\u76ee\u7684\u662f\u786e\u8ba4\u670d\u52a1\u5668\u4e0eOS\u901a\u8fc7certification<\/p>\n<p>Intel Xeon v3\u548cv4\u7684cpu,\u80fd\u652f\u6301\u7684RHEL\u7684\u6700\u4f4e\u7248\u672c\u662f\u4e0d\u4e00\u6837\u7684,<\/p>\n<p>\u8be6\u60c5\u8bf7\u89c1:<a href=\"https:\/\/access.redhat.com\/support\/policy\/intel\">https:\/\/access.redhat.com\/support\/policy\/intel<\/a><\/p>\n<p>Intel Xeon v3\u548cv4\u7684cpu,\u80fd\u652f\u6301\u7684Oracle Linux \u7684\u6700\u4f4e\u7248\u672c\u662f\u4e0d\u4e00\u6837\u7684,<\/p>\n<p>\u8be6\u60c5\u8bf7\u89c1:<a href=\"http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1\">http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1<\/a><\/p>\n<p>\u7b2c\u4e00:RedHat\u751f\u6001\u7cfb\u7edf&#8211;\u6765\u81eaRedHat\u7684\u8ba4\u8bc1\u5217\u8868<a href=\"https:\/\/access.redhat.com\/ecosystem\">https:\/\/access.redhat.com\/ecosystem<\/a><\/p>\n<p>\u7b2c\u4e8c:Oracle Linux \u5bf9\u670d\u52a1\u5668\u548c\u5b58\u50a8\u7684\u786c\u4ef6\u8ba4\u8bc1\u5217\u8868 <a href=\"http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1\">http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1<\/a><\/p>\n<h2><a id=\"user-content-\u5b89\u88c5\u5e38\u7528\u5305\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E5%AE%89%E8%A3%85%E5%B8%B8%E7%94%A8%E5%8C%85\"><\/a>\u5b89\u88c5\u5e38\u7528\u5305<\/h2>\n<pre><code># yum -y install coreutils glib2 lrzsz mpstat dstat sysstat e4fsprogs xfsprogs ntp readline-devel zlib-devel openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel gcc make smartmontools flex bison perl-devel perl-ExtUtils* openldap-devel jadetex  openjade bzip2\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u914d\u7f6eos\u5185\u6838\u53c2\u6570\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%85%8D%E7%BD%AEos%E5%86%85%E6%A0%B8%E5%8F%82%E6%95%B0\"><\/a>\u914d\u7f6eOS\u5185\u6838\u53c2\u6570<\/h2>\n<p>1. sysctl<\/p>\n<p>\u6ce8\u610f\u67d0\u4e9b\u53c2\u6570\uff0c\u6839\u636e\u5185\u5b58\u5927\u5c0f\u914d\u7f6e\uff08\u5df2\u8bf4\u660e\uff09<\/p>\n<p>\u542b\u4e49\u8be6\u89c1<\/p>\n<p><a href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201608\/20160803_01.md\">\u300aDBA\u4e0d\u53ef\u4e0d\u77e5\u7684\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u53c2\u6570\u300b<\/a><\/p>\n<pre><code># vi \/etc\/sysctl.conf\r\n\r\n# add by digoal.zhou\r\nfs.aio-max-nr = 1048576\r\nfs.file-max = 76724600\r\nkernel.core_pattern= \/data01\/corefiles\/core_%e_%u_%t_%s.%p         \r\n# \/data01\/corefiles\u4e8b\u5148\u5efa\u597d\uff0c\u6743\u9650777\uff0c\u5982\u679c\u662f\u8f6f\u94fe\u63a5\uff0c\u5bf9\u5e94\u7684\u76ee\u5f55\u4fee\u6539\u4e3a777\r\nkernel.sem = 4096 2147483647 2147483646 512000    \r\n# \u4fe1\u53f7\u91cf, ipcs -l \u6216 -u \u67e5\u770b\uff0c\u6bcf16\u4e2a\u8fdb\u7a0b\u4e00\u7ec4\uff0c\u6bcf\u7ec4\u4fe1\u53f7\u91cf\u9700\u898117\u4e2a\u4fe1\u53f7\u91cf\u3002\r\nkernel.shmall = 107374182      \r\n# \u6240\u6709\u5171\u4eab\u5185\u5b58\u6bb5\u76f8\u52a0\u5927\u5c0f\u9650\u5236(\u5efa\u8bae\u5185\u5b58\u768480%)\r\nkernel.shmmax = 274877906944   \r\n# \u6700\u5927\u5355\u4e2a\u5171\u4eab\u5185\u5b58\u6bb5\u5927\u5c0f(\u5efa\u8bae\u4e3a\u5185\u5b58\u4e00\u534a), &gt;9.2\u7684\u7248\u672c\u5df2\u5927\u5e45\u964d\u4f4e\u5171\u4eab\u5185\u5b58\u7684\u4f7f\u7528\r\nkernel.shmmni = 819200         \r\n# \u4e00\u5171\u80fd\u751f\u6210\u591a\u5c11\u5171\u4eab\u5185\u5b58\u6bb5\uff0c\u6bcf\u4e2aPG\u6570\u636e\u5e93\u96c6\u7fa4\u81f3\u5c112\u4e2a\u5171\u4eab\u5185\u5b58\u6bb5\r\nnet.core.netdev_max_backlog = 10000\r\nnet.core.rmem_default = 262144       \r\n# The default setting of the socket receive buffer in bytes.\r\nnet.core.rmem_max = 4194304          \r\n# The maximum receive socket buffer size in bytes\r\nnet.core.wmem_default = 262144       \r\n# The default setting (in bytes) of the socket send buffer.\r\nnet.core.wmem_max = 4194304          \r\n# The maximum send socket buffer size in bytes.\r\nnet.core.somaxconn = 4096\r\nnet.ipv4.tcp_max_syn_backlog = 4096\r\nnet.ipv4.tcp_keepalive_intvl = 20\r\nnet.ipv4.tcp_keepalive_probes = 3\r\nnet.ipv4.tcp_keepalive_time = 60\r\nnet.ipv4.tcp_mem = 8388608 12582912 16777216\r\nnet.ipv4.tcp_fin_timeout = 5\r\nnet.ipv4.tcp_synack_retries = 2\r\nnet.ipv4.tcp_syncookies = 1    \r\n# \u5f00\u542fSYN Cookies\u3002\u5f53\u51fa\u73b0SYN\u7b49\u5f85\u961f\u5217\u6ea2\u51fa\u65f6\uff0c\u542f\u7528cookie\u6765\u5904\u7406\uff0c\u53ef\u9632\u8303\u5c11\u91cf\u7684SYN\u653b\u51fb\r\nnet.ipv4.tcp_timestamps = 1    \r\n# \u51cf\u5c11time_wait\r\nnet.ipv4.tcp_tw_recycle = 0    \r\n# \u5982\u679c=1\u5219\u5f00\u542fTCP\u8fde\u63a5\u4e2dTIME-WAIT\u5957\u63a5\u5b57\u7684\u5feb\u901f\u56de\u6536\uff0c\u4f46\u662fNAT\u73af\u5883\u53ef\u80fd\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\uff0c\u5efa\u8bae\u670d\u52a1\u7aef\u5173\u95ed\u5b83\r\nnet.ipv4.tcp_tw_reuse = 1      \r\n# \u5f00\u542f\u91cd\u7528\u3002\u5141\u8bb8\u5c06TIME-WAIT\u5957\u63a5\u5b57\u91cd\u65b0\u7528\u4e8e\u65b0\u7684TCP\u8fde\u63a5\r\nnet.ipv4.tcp_max_tw_buckets = 262144\r\nnet.ipv4.tcp_rmem = 8192 87380 16777216\r\nnet.ipv4.tcp_wmem = 8192 65536 16777216\r\nnet.nf_conntrack_max = 1200000\r\nnet.netfilter.nf_conntrack_max = 1200000\r\nvm.dirty_background_bytes = 409600000       \r\n#  \u7cfb\u7edf\u810f\u9875\u5230\u8fbe\u8fd9\u4e2a\u503c\uff0c\u7cfb\u7edf\u540e\u53f0\u5237\u810f\u9875\u8c03\u5ea6\u8fdb\u7a0b pdflush\uff08\u6216\u5176\u4ed6\uff09 \u81ea\u52a8\u5c06(dirty_expire_centisecs\/100\uff09\u79d2\u524d\u7684\u810f\u9875\u5237\u5230\u78c1\u76d8\r\nvm.dirty_expire_centisecs = 3000             \r\n#  \u6bd4\u8fd9\u4e2a\u503c\u8001\u7684\u810f\u9875\uff0c\u5c06\u88ab\u5237\u5230\u78c1\u76d8\u30023000\u8868\u793a30\u79d2\u3002\r\nvm.dirty_ratio = 95                          \r\n#  \u5982\u679c\u7cfb\u7edf\u8fdb\u7a0b\u5237\u810f\u9875\u592a\u6162\uff0c\u4f7f\u5f97\u7cfb\u7edf\u810f\u9875\u8d85\u8fc7\u5185\u5b58 95 % \u65f6\uff0c\u5219\u7528\u6237\u8fdb\u7a0b\u5982\u679c\u6709\u5199\u78c1\u76d8\u7684\u64cd\u4f5c\uff08\u5982fsync, fdatasync\u7b49\u8c03\u7528\uff09\uff0c\u5219\u9700\u8981\u4e3b\u52a8\u628a\u7cfb\u7edf\u810f\u9875\u5237\u51fa\u3002\r\n#  \u6709\u6548\u9632\u6b62\u7528\u6237\u8fdb\u7a0b\u5237\u810f\u9875\uff0c\u5728\u5355\u673a\u591a\u5b9e\u4f8b\uff0c\u5e76\u4e14\u4f7f\u7528CGROUP\u9650\u5236\u5355\u5b9e\u4f8bIOPS\u7684\u60c5\u51b5\u4e0b\u975e\u5e38\u6709\u6548\u3002  \r\nvm.dirty_writeback_centisecs = 100            \r\n#  pdflush\uff08\u6216\u5176\u4ed6\uff09\u540e\u53f0\u5237\u810f\u9875\u8fdb\u7a0b\u7684\u5524\u9192\u95f4\u9694\uff0c 100\u8868\u793a1\u79d2\u3002\r\nvm.mmap_min_addr = 65536\r\nvm.overcommit_memory = 0     \r\n#  \u5728\u5206\u914d\u5185\u5b58\u65f6\uff0c\u5141\u8bb8\u5c11\u91cfover malloc, \u5982\u679c\u8bbe\u7f6e\u4e3a 1, \u5219\u8ba4\u4e3a\u603b\u662f\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u5185\u5b58\u8f83\u5c11\u7684\u6d4b\u8bd5\u73af\u5883\u53ef\u4ee5\u4f7f\u7528 1 .  \r\nvm.overcommit_ratio = 90     \r\n#  \u5f53overcommit_memory = 2 \u65f6\uff0c\u7528\u4e8e\u53c2\u4e0e\u8ba1\u7b97\u5141\u8bb8\u6307\u6d3e\u7684\u5185\u5b58\u5927\u5c0f\u3002\r\nvm.swappiness = 0            \r\n#  \u5173\u95ed\u4ea4\u6362\u5206\u533a\r\nvm.zone_reclaim_mode = 0     \r\n# \u7981\u7528 numa, \u6216\u8005\u5728vmlinux\u4e2d\u7981\u6b62. \r\nnet.ipv4.ip_local_port_range = 40000 65535    \r\n# \u672c\u5730\u81ea\u52a8\u5206\u914d\u7684TCP, UDP\u7aef\u53e3\u53f7\u8303\u56f4\r\nfs.nr_open=20480000\r\n# \u5355\u4e2a\u8fdb\u7a0b\u5141\u8bb8\u6253\u5f00\u7684\u6587\u4ef6\u53e5\u67c4\u4e0a\u9650\r\n\r\n# \u4ee5\u4e0b\u53c2\u6570\u8bf7\u6ce8\u610f\r\n# vm.extra_free_kbytes = 4096000\r\n# vm.min_free_kbytes = 2097152\r\n# \u5982\u679c\u662f\u5c0f\u5185\u5b58\u673a\u5668\uff0c\u4ee5\u4e0a\u4e24\u4e2a\u503c\u4e0d\u5efa\u8bae\u8bbe\u7f6e\r\n# vm.nr_hugepages = 66536    \r\n#  \u5efa\u8baeshared buffer\u8bbe\u7f6e\u8d85\u8fc764GB\u65f6 \u4f7f\u7528\u5927\u9875\uff0c\u9875\u5927\u5c0f \/proc\/meminfo Hugepagesize\r\n# vm.lowmem_reserve_ratio = 1 1 1\r\n# \u5bf9\u4e8e\u5185\u5b58\u5927\u4e8e64G\u65f6\uff0c\u5efa\u8bae\u8bbe\u7f6e\uff0c\u5426\u5219\u5efa\u8bae\u9ed8\u8ba4\u503c 256 256 32\r\n<\/code><\/pre>\n<p>2. \u751f\u6548\u914d\u7f6e<\/p>\n<pre><code>sysctl -p\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u914d\u7f6eos\u8d44\u6e90\u9650\u5236\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%85%8D%E7%BD%AEos%E8%B5%84%E6%BA%90%E9%99%90%E5%88%B6\"><\/a>\u914d\u7f6eOS\u8d44\u6e90\u9650\u5236<\/h2>\n<pre><code># vi \/etc\/security\/limits.conf\r\n\r\n# nofile\u8d85\u8fc71048576\u7684\u8bdd\uff0c\u4e00\u5b9a\u8981\u5148\u5c06sysctl\u7684fs.nr_open\u8bbe\u7f6e\u4e3a\u66f4\u5927\u7684\u503c\uff0c\u5e76\u751f\u6548\u540e\u624d\u80fd\u7ee7\u7eed\u8bbe\u7f6enofile.\r\n\r\n* soft    nofile  1024000\r\n* hard    nofile  1024000\r\n* soft    nproc   unlimited\r\n* hard    nproc   unlimited\r\n* soft    core    unlimited\r\n* hard    core    unlimited\r\n* soft    memlock unlimited\r\n* hard    memlock unlimited\r\n<\/code><\/pre>\n<p>\u6700\u597d\u5728\u5173\u6ce8\u4e00\u4e0b\/etc\/security\/limits.d\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u5185\u5bb9\uff0c\u4f1a\u8986\u76d6limits.conf\u7684\u914d\u7f6e\u3002<\/p>\n<p>\u5df2\u6709\u8fdb\u7a0b\u7684ulimit\u8bf7\u67e5\u770b\/proc\/pid\/limits\uff0c\u4f8b\u5982<\/p>\n<pre><code>Limit                     Soft Limit           Hard Limit           Units     \r\nMax cpu time              unlimited            unlimited            seconds   \r\nMax file size             unlimited            unlimited            bytes     \r\nMax data size             unlimited            unlimited            bytes     \r\nMax stack size            10485760             unlimited            bytes     \r\nMax core file size        0                    unlimited            bytes     \r\nMax resident set          unlimited            unlimited            bytes     \r\nMax processes             11286                11286                processes \r\nMax open files            1024                 4096                 files     \r\nMax locked memory         65536                65536                bytes     \r\nMax address space         unlimited            unlimited            bytes     \r\nMax file locks            unlimited            unlimited            locks     \r\nMax pending signals       11286                11286                signals   \r\nMax msgqueue size         819200               819200               bytes     \r\nMax nice priority         0                    0                    \r\nMax realtime priority     0                    0                    \r\nMax realtime timeout      unlimited            unlimited            us\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u8981\u542f\u52a8\u5176\u4ed6\u8fdb\u7a0b\uff0c\u5efa\u8bae\u9000\u51faSHELL\u518d\u8fdb\u4e00\u904d\uff0c\u786e\u8ba4ulimit\u73af\u5883\u914d\u7f6e\u5df2\u751f\u6548\uff0c\u518d\u542f\u52a8\u3002<\/p>\n<h2><a id=\"user-content-\u914d\u7f6eos\u9632\u706b\u5899\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%85%8D%E7%BD%AEos%E9%98%B2%E7%81%AB%E5%A2%99\"><\/a>\u914d\u7f6eOS\u9632\u706b\u5899<\/h2>\n<p>\uff08\u5efa\u8bae\u6309\u4e1a\u52a1\u573a\u666f\u8bbe\u7f6e\uff0c\u6211\u8fd9\u91cc\u5148\u6e05\u6389\uff09<\/p>\n<pre><code>iptables -F\r\n<\/code><\/pre>\n<p>\u914d\u7f6e\u8303\u4f8b<\/p>\n<pre><code># \u79c1\u6709\u7f51\u6bb5\r\n-A INPUT -s 192.168.0.0\/16 -j ACCEPT\r\n-A INPUT -s 10.0.0.0\/8 -j ACCEPT\r\n-A INPUT -s 172.16.0.0\/16 -j ACCEPT\r\n<\/code><\/pre>\n<h2><a id=\"user-content-selinux\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#selinux\"><\/a>selinux<\/h2>\n<p>\u5982\u679c\u6ca1\u6709\u8fd9\u65b9\u9762\u7684\u9700\u6c42\uff0c\u5efa\u8bae\u7981\u7528<\/p>\n<pre><code># vi \/etc\/sysconfig\/selinux \r\n\r\nSELINUX=disabled\r\nSELINUXTYPE=targeted\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u5173\u95ed\u4e0d\u5fc5\u8981\u7684os\u670d\u52a1\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E5%85%B3%E9%97%AD%E4%B8%8D%E5%BF%85%E8%A6%81%E7%9A%84os%E6%9C%8D%E5%8A%A1\"><\/a>\u5173\u95ed\u4e0d\u5fc5\u8981\u7684OS\u670d\u52a1<\/h2>\n<pre><code>chkconfig --list|grep on  \r\n\u5173\u95ed\u4e0d\u5fc5\u8981\u7684,\u4f8b\u5982 \r\nchkconfig iscsi off\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u90e8\u7f72\u6587\u4ef6\u7cfb\u7edf\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%83%A8%E7%BD%B2%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F\"><\/a>\u90e8\u7f72\u6587\u4ef6\u7cfb\u7edf<\/h2>\n<p>\u6ce8\u610fSSD\u5bf9\u9f50\uff0c\u5ef6\u957f\u5bff\u547d\uff0c\u907f\u514d\u5199\u653e\u5927\u3002<\/p>\n<pre><code>parted -s \/dev\/sda mklabel gpt\r\nparted -s \/dev\/sda mkpart primary 1MiB 100%\r\n<\/code><\/pre>\n<p>\u683c\u5f0f\u5316(\u5982\u679c\u4f60\u9009\u62e9ext4\u7684\u8bdd)<\/p>\n<pre><code>mkfs.ext4 \/dev\/sda1 -m 0 -O extent,uninit_bg -E lazy_itable_init=1 -T largefile -L u01\r\n<\/code><\/pre>\n<p>\u5efa\u8bae\u4f7f\u7528\u7684ext4 mount\u9009\u9879<\/p>\n<pre><code># vi \/etc\/fstab\r\n\r\nLABEL=u01 \/u01     ext4        defaults,noatime,nodiratime,nodelalloc,barrier=0,data=writeback    0 0\r\n\r\n# mkdir \/u01\r\n# mount -a\r\n<\/code><\/pre>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981data=writeback?<\/p>\n<p><a href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01_pic_001.png\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/github.com\/digoal\/blog\/raw\/master\/201611\/20161121_01_pic_001.png\" alt=\"pic\" \/><\/a><\/p>\n<p>\u5efa\u8baepg_xlog\u653e\u5230\u72ec\u7acb\u7684IOPS\u6027\u80fd\u8d3c\u597d\u7684\u5757\u8bbe\u5907\u4e2d\u3002<\/p>\n<h2><a id=\"user-content-\u8bbe\u7f6essd\u76d8\u7684\u8c03\u5ea6\u4e3adeadline\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E8%AE%BE%E7%BD%AEssd%E7%9B%98%E7%9A%84%E8%B0%83%E5%BA%A6%E4%B8%BAdeadline\"><\/a>\u8bbe\u7f6eSSD\u76d8\u7684\u8c03\u5ea6\u4e3adeadline<\/h2>\n<p>\u5982\u679c\u4e0d\u662fSSD\u7684\u8bdd\uff0c\u8fd8\u662f\u4f7f\u7528CFQ\uff0c\u5426\u5219\u5efa\u8bae\u4f7f\u7528DEADLINE\u3002<\/p>\n<p>\u4e34\u65f6\u8bbe\u7f6e(\u6bd4\u5982sda\u76d8)<\/p>\n<pre><code>echo deadline &gt; \/sys\/block\/sda\/queue\/scheduler\r\n<\/code><\/pre>\n<p>\u6c38\u4e45\u8bbe\u7f6e<\/p>\n<p>\u7f16\u8f91grub\u6587\u4ef6\u4fee\u6539\u5757\u8bbe\u5907\u8c03\u5ea6\u7b56\u7565<\/p>\n<pre><code>vi \/boot\/grub.conf\r\n\r\nelevator=deadline\r\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff0c\u5982\u679c\u65e2\u6709\u673a\u68b0\u76d8\uff0c\u53c8\u6709SSD\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528\/etc\/rc.local\uff0c\u5bf9\u6307\u5b9a\u78c1\u76d8\u4fee\u6539\u4e3a\u5bf9\u5e94\u7684\u8c03\u5ea6\u7b56\u7565\u3002<\/p>\n<h2><a id=\"user-content-\u5173\u95ed\u900f\u660e\u5927\u9875numa\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E5%85%B3%E9%97%AD%E9%80%8F%E6%98%8E%E5%A4%A7%E9%A1%B5numa\"><\/a>\u5173\u95ed\u900f\u660e\u5927\u9875\u3001numa<\/h2>\n<p>\u52a0\u4e0a\u524d\u9762\u7684\u9ed8\u8ba4IO\u8c03\u5ea6\uff0c\u5982\u4e0b<\/p>\n<pre><code>vi \/boot\/grub.conf\r\n\r\nelevator=deadline numa=off transparent_hugepage=never \r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u7f16\u8bd1\u5668\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E7%BC%96%E8%AF%91%E5%99%A8\"><\/a>\u7f16\u8bd1\u5668<\/h2>\n<p>\u5efa\u8bae\u4f7f\u7528\u8f83\u65b0\u7684\u7f16\u8bd1\u5668\uff0c\u5b89\u88c5 gcc 6.2.0 \u7565<\/p>\n<pre><code>cd ~\r\ntar -jxvf gcc6.2.0.tar.bz2\r\ntar -jxvf python2.7.12.tar.bz2\r\n\r\n\r\n# vi \/etc\/ld.so.conf\r\n\r\n\/home\/digoal\/gcc6.2.0\/lib\r\n\/home\/digoal\/gcc6.2.0\/lib64\r\n\/home\/digoal\/python2.7.12\/lib\r\n\r\n# ldconfig\r\n<\/code><\/pre>\n<p>\u73af\u5883\u53d8\u91cf<\/p>\n<pre><code># vi ~\/env_pg.sh\r\n\r\nexport PS1=\"$USER@`\/bin\/hostname -s`-&gt; \"\r\nexport PGPORT=$1\r\nexport PGDATA=\/$2\/digoal\/pg_root$PGPORT\r\nexport LANG=en_US.utf8\r\nexport PGHOME=\/home\/digoal\/pgsql9.6\r\nexport LD_LIBRARY_PATH=\/home\/digoal\/gcc6.2.0\/lib:\/home\/digoal\/gcc6.2.0\/lib64:\/home\/digoal\/python2.7.12\/lib:$PGHOME\/lib:\/lib64:\/usr\/lib64:\/usr\/local\/lib64:\/lib:\/usr\/lib:\/usr\/local\/lib:$LD_LIBRARY_PATH\r\nexport PATH=\/home\/digoal\/gcc6.2.0\/bin:\/home\/digoal\/python2.7.12\/bin:\/home\/digoal\/cmake3.6.3\/bin:$PGHOME\/bin:$PATH:.\r\nexport DATE=`date +\"%Y%m%d%H%M\"`\r\nexport MANPATH=$PGHOME\/share\/man:$MANPATH\r\nexport PGHOST=$PGDATA\r\nexport PGUSER=postgres\r\nexport PGDATABASE=postgres\r\nalias rm='rm -i'\r\nalias ll='ls -lh'\r\nunalias vi\r\n<\/code><\/pre>\n<h3><a id=\"user-content-icc-clang\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#icc-clang\"><\/a>icc, clang<\/h3>\n<p>\u5982\u679c\u4f60\u60f3\u4f7f\u7528ICC\u6216\u8005clang\u7f16\u8bd1PostgreSQL\uff0c\u8bf7\u53c2\u8003<\/p>\n<p><a href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201605\/20160524_03.md\">\u300a[\u8f6c\u8f7d]\u7528intel\u7f16\u8bd1\u5668icc\u7f16\u8bd1PostgreSQL\u300b<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161106_01.md\">\u300aPostgreSQL clang vs gcc \u7f16\u8bd1\u300b<\/a><\/p>\n<h2><a id=\"user-content-\u7f16\u8bd1postgresql\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E7%BC%96%E8%AF%91postgresql\"><\/a>\u7f16\u8bd1PostgreSQL<\/h2>\n<p>\u5efa\u8bae\u4f7f\u7528NAMED_POSIX_SEMAPHORES<\/p>\n<pre><code>src\/backend\/port\/posix_sema.c\r\n\r\ncreate sem : \r\nnamed :\r\n                mySem = sem_open(semname, O_CREAT | O_EXCL,\r\n                                                 (mode_t) IPCProtection, (unsigned) 1);\r\n\r\n\r\nunamed :\r\n\/*\r\n * PosixSemaphoreCreate\r\n *\r\n * Attempt to create a new unnamed semaphore.\r\n *\/\r\nstatic void\r\nPosixSemaphoreCreate(sem_t * sem)\r\n{\r\n        if (sem_init(sem, 1, 1) &lt; 0)\r\n                elog(FATAL, \"sem_init failed: %m\");\r\n}\r\n\r\n\r\nremove sem : \r\n\r\n#ifdef USE_NAMED_POSIX_SEMAPHORES\r\n        \/* Got to use sem_close for named semaphores *\/\r\n        if (sem_close(sem) &lt; 0)\r\n                elog(LOG, \"sem_close failed: %m\");\r\n#else\r\n        \/* Got to use sem_destroy for unnamed semaphores *\/\r\n        if (sem_destroy(sem) &lt; 0)\r\n                elog(LOG, \"sem_destroy failed: %m\");\r\n#endif\r\n<\/code><\/pre>\n<p>\u7f16\u8bd1\u9879<\/p>\n<pre><code>. ~\/env_pg.sh 1921 u01\r\n\r\ncd postgresql-9.6.1\r\nexport USE_NAMED_POSIX_SEMAPHORES=1\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O3 -flto\" .\/configure --prefix=\/home\/digoal\/pgsql9.6\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O3 -flto\" make world -j 64\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O3 -flto\" make install-world\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u662f\u5f00\u53d1\u73af\u5883\uff0c\u9700\u8981\u8c03\u8bd5\uff0c\u5efa\u8bae\u8fd9\u6837\u7f16\u8bd1\u3002<\/p>\n<pre><code>cd postgresql-9.6.1\r\nexport USE_NAMED_POSIX_SEMAPHORES=1\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O0 -flto -g -ggdb -fno-omit-frame-pointer\" .\/configure --prefix=\/home\/digoal\/pgsql9.6 --enable-cassert\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O0 -flto -g -ggdb -fno-omit-frame-pointer\" make world -j 64\r\nLIBS=-lpthread CC=\"\/home\/digoal\/gcc6.2.0\/bin\/gcc\" CFLAGS=\"-O0 -flto -g -ggdb -fno-omit-frame-pointer\" make install-world\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7fa4\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E5%88%9D%E5%A7%8B%E5%8C%96%E6%95%B0%E6%8D%AE%E5%BA%93%E9%9B%86%E7%BE%A4\"><\/a>\u521d\u59cb\u5316\u6570\u636e\u5e93\u96c6\u7fa4<\/h2>\n<p>pg_xlog\u5efa\u8bae\u653e\u5728IOPS\u6700\u597d\u7684\u5206\u533a\u3002<\/p>\n<pre><code>. ~\/env_pg.sh 1921 u01\r\ninitdb -D $PGDATA -E UTF8 --locale=C -U postgres -X \/u02\/digoal\/pg_xlog$PGPORT\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u914d\u7f6epostgresqlconf\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%85%8D%E7%BD%AEpostgresqlconf\"><\/a>\u914d\u7f6epostgresql.conf<\/h2>\n<p>\u4ee5PostgreSQL 9.6, 512G\u5185\u5b58\u4e3b\u673a\u4e3a\u4f8b<\/p>\n<pre><code>\u6700\u4f73\u5230\u6587\u4ef6\u672b\u5c3e\u5373\u53ef\uff0c\u91cd\u590d\u7684\u4f1a\u4ee5\u672b\u5c3e\u7684\u4f5c\u4e3a\u6709\u6548\u503c\u3002  \r\n  \r\n$ vi postgresql.conf\r\n\r\nlisten_addresses = '0.0.0.0'\r\nport = 1921\r\nmax_connections = 5000\r\nunix_socket_directories = '.'\r\ntcp_keepalives_idle = 60\r\ntcp_keepalives_interval = 10\r\ntcp_keepalives_count = 10\r\nshared_buffers = 128GB\r\nmaintenance_work_mem = 4GB\r\ndynamic_shared_memory_type = posix\r\nvacuum_cost_delay = 0\r\nbgwriter_delay = 10ms\r\nbgwriter_lru_maxpages = 1000\r\nbgwriter_lru_multiplier = 10.0\r\nbgwriter_flush_after = 0  # IO\u5f88\u597d\u7684\u673a\u5668\uff0c\u4e0d\u9700\u8981\u8003\u8651\u5e73\u6ed1\u8c03\u5ea6\r\nmax_worker_processes = 128\r\nmax_parallel_workers_per_gather = 0\r\nold_snapshot_threshold = -1\r\nbackend_flush_after = 0  # IO\u5f88\u597d\u7684\u673a\u5668\uff0c\u4e0d\u9700\u8981\u8003\u8651\u5e73\u6ed1\u8c03\u5ea6\r\nwal_level = replica\r\nsynchronous_commit = off\r\nfull_page_writes = on\r\nwal_buffers = 1GB\r\nwal_writer_delay = 10ms\r\nwal_writer_flush_after = 0  # IO\u5f88\u597d\u7684\u673a\u5668\uff0c\u4e0d\u9700\u8981\u8003\u8651\u5e73\u6ed1\u8c03\u5ea6\r\ncheckpoint_timeout = 30min  # \u4e0d\u5efa\u8bae\u9891\u7e41\u505a\u68c0\u67e5\u70b9\uff0c\u5426\u5219XLOG\u4f1a\u4ea7\u751f\u5f88\u591a\u7684FULL PAGE WRITE\u3002\r\nmax_wal_size = 256GB  # \u5efa\u8bae\u662fSHARED BUFFER\u76842\u500d\r\nmin_wal_size = 64GB\r\ncheckpoint_completion_target = 0.05  # \u786c\u76d8\u597d\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u8ba9\u68c0\u67e5\u70b9\u5feb\u901f\u7ed3\u675f\uff0c\u6062\u590d\u65f6\u4e5f\u53ef\u4ee5\u5feb\u901f\u8fbe\u5230\u4e00\u81f4\u72b6\u6001\u3002\r\ncheckpoint_flush_after = 0  # IO\u5f88\u597d\u7684\u673a\u5668\uff0c\u4e0d\u9700\u8981\u8003\u8651\u5e73\u6ed1\u8c03\u5ea6\r\narchive_mode = on\r\narchive_command = '\/bin\/date'      #  \u540e\u671f\u518d\u4fee\u6539\uff0c\u5982  'test ! -f \/disk1\/digoal\/arch\/%f &amp;&amp; cp %p \/disk1\/digoal\/arch\/%f'\r\nmax_wal_senders = 8\r\nrandom_page_cost = 1.3  # IO\u5f88\u597d\u7684\u673a\u5668\uff0c\u4e0d\u9700\u8981\u8003\u8651\u79bb\u6563\u548c\u987a\u5e8f\u626b\u63cf\u7684\u6210\u672c\u5dee\u5f02\r\nparallel_tuple_cost = 0\r\nparallel_setup_cost = 0\r\nmin_parallel_relation_size = 0\r\neffective_cache_size = 300GB  # \u770b\u7740\u529e\uff0c\u5269\u4e0b\u7684\u90fd\u662fOS\u53ef\u7528\u7684CACHE\u3002\r\nforce_parallel_mode = off\r\nlog_destination = 'csvlog'\r\nlogging_collector = on\r\nlog_truncate_on_rotation = on\r\nlog_checkpoints = on\r\nlog_connections = on\r\nlog_disconnections = on\r\nlog_error_verbosity = verbose\r\nlog_timezone = 'PRC'\r\nvacuum_defer_cleanup_age = 0\r\nhot_standby_feedback = off\r\nmax_standby_archive_delay = 300s\r\nmax_standby_streaming_delay = 300s\r\nautovacuum = on\r\nlog_autovacuum_min_duration = 0\r\nautovacuum_max_workers = 16  # CPU\u6838\u591a\uff0c\u5e76\u4e14IO\u597d\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u591a\u70b9\uff0c\u4f46\u662f\u6ce8\u610f16*autovacuum mem\uff0c\u4f1a\u6d88\u8017\u8f83\u591a\u5185\u5b58\uff0c\u6240\u4ee5\u5185\u5b58\u4e5f\u8981\u6709\u57fa\u7840\u3002  \r\nautovacuum_naptime = 30s\r\nautovacuum_vacuum_scale_factor = 0.1\r\nautovacuum_analyze_scale_factor = 0.2\r\nautovacuum_freeze_max_age = 1600000000\r\nautovacuum_multixact_freeze_max_age = 1600000000\r\nvacuum_freeze_table_age = 1500000000\r\nvacuum_multixact_freeze_table_age = 1500000000\r\ndatestyle = 'iso, mdy'\r\ntimezone = 'PRC'\r\nlc_messages = 'C'\r\nlc_monetary = 'C'\r\nlc_numeric = 'C'\r\nlc_time = 'C'\r\ndefault_text_search_config = 'pg_catalog.english'\r\nshared_preload_libraries='pg_stat_statements'\r\n\r\n## \u5982\u679c\u4f60\u7684\u6570\u636e\u5e93\u6709\u975e\u5e38\u591a\u5c0f\u6587\u4ef6\uff08\u6bd4\u5982\u6709\u51e0\u5341\u4e07\u4ee5\u4e0a\u7684\u8868\uff0c\u8fd8\u6709\u7d22\u5f15\u7b49\uff0c\u5e76\u4e14\u6bcf\u5f20\u8868\u90fd\u4f1a\u88ab\u8bbf\u95ee\u5230\u65f6\uff09\uff0c\u5efa\u8baeFD\u53ef\u4ee5\u8bbe\u591a\u4e00\u4e9b\uff0c\u907f\u514d\u8fdb\u7a0b\u9700\u8981\u6253\u5f00\u5173\u95ed\u6587\u4ef6\u3002\r\n## \u4f46\u662f\u4e0d\u8981\u5927\u4e8e\u524d\u9762\u7ae0\u8282\u7cfb\u7edf\u8bbe\u7f6e\u7684ulimit -n(open files)\r\nmax_files_per_process=655360\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u914d\u7f6epg_hbaconf\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E9%85%8D%E7%BD%AEpg_hbaconf\"><\/a>\u914d\u7f6epg_hba.conf<\/h2>\n<p>\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u8bbf\u95ee\uff0c\u5f00\u653e\u5141\u8bb8\u7684\u8bbf\u95ee\uff0c\u5efa\u8bae\u52a1\u5fc5\u4f7f\u7528\u5bc6\u7801\u8bbf\u95ee\u3002<\/p>\n<pre><code>$ vi pg_hba.conf\r\n\r\nhost replication xx 0.0.0.0\/0 md5  # \u6d41\u590d\u5236\r\n\r\nhost all postgres 0.0.0.0\/0 reject # \u62d2\u7edd\u8d85\u7ea7\u7528\u6237\u4ece\u7f51\u7edc\u767b\u5f55\r\nhost all all 0.0.0.0\/0 md5  # \u5176\u4ed6\u7528\u6237\u767b\u9646\r\n<\/code><\/pre>\n<h2><a id=\"user-content-\u542f\u52a8\u6570\u636e\u5e93\" class=\"anchor\" href=\"https:\/\/github.com\/digoal\/blog\/blob\/master\/201611\/20161121_01.md#%E5%90%AF%E5%8A%A8%E6%95%B0%E6%8D%AE%E5%BA%93\"><\/a>\u542f\u52a8\u6570\u636e\u5e93<\/h2>\n<pre><code>pg_ctl start\r\n<\/code><\/pre>\n<p>\u597d\u4e86\uff0c\u4f60\u7684PostgreSQL\u6570\u636e\u5e93\u57fa\u672c\u4e0a\u90e8\u7f72\u597d\u4e86\uff0c\u53ef\u4ee5\u6109\u5feb\u7684\u73a9\u800d\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u6570\u636e\u5e93\u7684\u5b89\u88c5\u4e00\u76f4\u4ee5\u6765\u90fd\u633a\u590d\u6742\u7684\uff0c\u7279\u522b\u662fOracle\uff0c\u73b0\u5728\u8eab\u8fb9\u90fd\u8fd8\u6709\u5b89\u88c5Oracle\u6570\u636e\u5e93\u8d5a\u5916\u5feb\u7684\u4e8b\u60c5\u3002 PostgreSQL\u5176\u5b9e\u5b89\u88c5\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u90a3\u4ec5\u4ec5\u662f\u53ef\u7528\uff0c\u5e76\u4e0d\u662f\u597d\u7528\u3002\u5f88\u591a\u7528\u6237\u4f7f\u7528\u9ed8\u8ba4\u7684\u65b9\u6cd5\u5b89\u88c5\u597d\u6570\u636e\u5e93\u4e4b\u540e\uff0c\u7136\u540e\u6d4b\u8bd5\u4e00\u901a\u6027\u80fd\uff0c\u53d1\u73b0\u6027\u80fd\u4e0d\u884c\u5c31\u4e0d\u7528\u4e86\u3002 \u539f\u56e0\u4e0d\u7528\u8bf4\uff0c\u591a\u65b9\u9762\u6ca1\u6709\u4f18\u5316\u7684\u7ed3\u679c\u3002 PostgreSQL\u6570\u636e\u5e93\u4e3a\u4e86\u9002\u5e94\u66f4\u591a\u7684\u573a\u666f\u80fd\u4f7f\u7528\uff0c\u9ed8\u8ba4\u7684\u53c2\u6570\u90fd\u8bbe\u5f97\u975e\u5e38\u4fdd\u5b88\uff0c\u901a\u5e38\u9700\u8981\u4f18\u5316\uff0c\u6bd4\u5982\u68c0\u67e5\u70b9\uff0cSHARED BUFFER\u7b49\u3002 \u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u4e0bPostgreSQL on Linux\u7684\u6700\u4f73\u90e8\u7f72\u65b9\u6cd5\uff0c\u5176\u5b9e\u5728\u6211\u7684\u5f88\u591a\u6587\u7ae0\u4e2d\u90fd\u6709\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u4f46\u662f\u6ca1\u6709\u603b\u7ed3\u6210\u4e00\u7bc7\u6587\u6863\u3002 OS\u4e0e\u786c\u4ef6\u8ba4\u8bc1\u68c0\u67e5 \u76ee\u7684\u662f\u786e\u8ba4\u670d\u52a1\u5668\u4e0eOS\u901a\u8fc7certification Intel Xeon v3\u548cv4\u7684cpu,\u80fd\u652f\u6301\u7684RHEL\u7684\u6700\u4f4e\u7248\u672c\u662f\u4e0d\u4e00\u6837\u7684, \u8be6\u60c5\u8bf7\u89c1:https:\/\/access.redhat.com\/support\/policy\/intel Intel Xeon v3\u548cv4\u7684cpu,\u80fd\u652f\u6301\u7684Oracle Linux \u7684\u6700\u4f4e\u7248\u672c\u662f\u4e0d\u4e00\u6837\u7684, \u8be6\u60c5\u8bf7\u89c1:http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1 \u7b2c\u4e00:RedHat\u751f\u6001\u7cfb\u7edf&#8211;\u6765\u81eaRedHat\u7684\u8ba4\u8bc1\u5217\u8868https:\/\/access.redhat.com\/ecosystem \u7b2c\u4e8c:Oracle Linux \u5bf9\u670d\u52a1\u5668\u548c\u5b58\u50a8\u7684\u786c\u4ef6\u8ba4\u8bc1\u5217\u8868 http:\/\/linux.oracle.com\/pls\/apex\/f?p=117:1 \u5b89\u88c5\u5e38\u7528\u5305 # yum -y install coreutils glib2 lrzsz mpstat dstat sysstat e4fsprogs xfsprogs ntp readline-devel zlib-devel openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel gcc make smartmontools flex bison perl-devel perl-ExtUtils* &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1386\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">PostgreSQL on Linux \u6700\u4f73\u90e8\u7f72\u624b\u518c<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,20],"tags":[21,212],"class_list":["post-1386","post","type-post","status-publish","format-standard","hentry","category-linux","category-20","tag-linux-2","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1386"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1386\/revisions"}],"predecessor-version":[{"id":1387,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1386\/revisions\/1387"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}