弄滯橉媇単䕏劸垵潙䆇誂毖䔇 TCP/IP 婄应㔗唚滇婔婻锖埙彖锫䔇婂橺劉启/潡昄庖 IP 婄应㔗䬹枪釹 * 凹庫欔橬埇䫘 IP 毖埼㔗套悩認婻彖臘滇䷺䔇闼幽橉媇単婉嚔䕏劸傂嘘 IP 毖埼認䓉愙喕婋埻橬 Unix 嘘喖毖庖埇傖䫘庯誂毖昄扞康㔗䚺䩕唚 localhost 埻噕螩誕臯橸婄"啂䯇"誂毖㔗認婻埗昄埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
橉媇単䕏劸䔇 TCP 䆇埼䚺䩕滇 5432 㔗臙濘懟劯婔婻䆇埼埙䫘庯橉媇単䕏劸䔇欔橬 IP 婄应㔗認婻埗昄埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
噕螩启昄扞康誂毖䔇橔崓幽埏誂毖昄㔗䚺䩕锔婩滇 100 嘖滇套悩喙湩螆䘞婉櫇毕認幽崓(婘 initdb 䔇施唍彴桺)埇脘嚔懫認婻昄儏㔗認婻埗昄埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
嵂崓認婻埗昄埇脘凚躘 PostgreSQL 襕挗敘崔䔇 System V 噌庆喙庻潡蔙媇埙䕇埇脘轙誺淉嘩係䂘䚺䩕陉䘞䔇螩埇唚㔗媙襕䔇臺埗黙誗16.4.1诙埡橬噿套嘘脄誗認婻埗昄䔇媇敇㔗
喿垔婺 PostgreSQL 轙亓䫘潙誂毖蔯媺䘍䔇誂毖"擘嘉"㔗婔渇橔崔埇傖劯施檔昂 max_connections 婻誂毖㔗婘昂虄䔇幽埏誂昄毖彄庖 max_connections 废寂 superuser_reserved_connections 䔇施唍桄䔇誂毖儌埻脘䫌轙亓䫘潙埏蕙庖㔗
䚺䩕唚滇 3 㔗認婻唚媙釂償庯 max_connections 䔇唚㔗認婻埗昄埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
弄滯橉媇単䕏劸垵潙䆇誂毖䔇 Unix 嘘喖毖庖䕞嘘㔗䚺䩕锔婩滇 /tmp 嘖滇埇傖婘䚡臏䔇施唍媞櫹㔗認婻唚埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
螆䘞 Unix 嘘喖毖庖䔇欔匂䂇(喖毖庖䔇欔匂䫘潙攂滇劇媘橉媇単䔇䫘潙)㔗埇傖婯锬釹 unix_socket_permissions 婔蕙䫘庯凹喖毖庖誕臯螪閞毓彽㔗䚺䩕滇婔婻䷺庖严婾臘䴺嘷嬉䫘潙䔇䚺䩕䂇㔗認婻锬釹埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
螆䘞 Unix 嘘喖毖庖䔇螪閞溄鍊㔗Unix 嘘喖毖庖嘪䫘捞锔䔇 Unix 桺傽係䂘溄鍊镖㔗認婻锬釹唚庫臖滇昄唚䔇嘵嚟幘儌滇闼䓉 Unix 嘘喖毖庖脄䫘 chmod
启 umask
毖埖䔇嘵嚟㔗套悩嘪䫘躻垔幬䔇噆誕彽湚嚟昄庖媙釂傖 0 嚔崘㔗
䚺䩕䔇溄鍊滇 0777 懟攺滇傂嘘庺鄘埇傖誂毖㔗劽䊖䔇唍锬滇 0770(埻橬䫘潙启劯䂇䔇庺埇傖螪閞埽蓕 unix_socket_group)启 0700(埻橬䫘潙躻噌埇傖螪閞)㔗臙濘懟凹庯 Unix 嘘喖毖庖埻橬喍溄鍊橬懟幬臂启欓臯溄鍊澇橬傂嘘懟幬㔗
認婻螪閞毓彽橺彽婯䆹20麯柟誄䔇䫘潙螴臕懆方噿係㔗
認婻唚埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
弄滯 Bonjour 幪携劉䓄㔗䷺庖严婾 ''(䚺䩕唚)臘䴺嘪䫘螇䞖橺劉㔗套悩䚡臏施澇橬欷嚔 Bonjour 櫇毕闼幽儖媘䘖認婻埗昄㔗認婻唚埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
婘闼底櫇毕 TCP_KEEPIDLE 喖毖庖锬釹䔇係䂘婪弄滯埏锕媺毕昂虄媇埙䔇閘锫䓐昄婉埏锕媺毕昂虄媇埙誂毖儌嚔崇庯閾䘞䪽攕㔗镽嘪䫘係䂘䚺䩕㔗套悩婉櫇毕 TCP_KEEPIDLE 認婻埗昄媙釂婺镽㔗婘锔誺 Unix 嘘喖毖庖誕臯䔇誂毖婪認婻锬釹赆媘䘖㔗
婘闼底櫇毕 TCP_KEEPINTVL 喖毖庖锬釹䔇係䂘婪傖䓐昄弄滯婘麉桄嚹膷幋閘京写巉庫䔇施閘㔗镽嘪䫘係䂘䚺䩕㔗套悩婉櫇毕 TCP_KEEPINTVL 認婻埗昄媙釂婺镽㔗婘锔誺 Unix 嘘喖毖庖誕臯䔇誂毖婪認婻锬釹赆媘䘖㔗
婘櫇毕 TCP_KEEPCNT 喖毖庖锬釹䔇係䂘婪弄滯婘彺桺誂毖幋嬉埇傖婵崌崔儏婻媺毕昂虄媇埙㔗镽嘪䫘係䂘䚺䩕㔗套悩婉櫇毕 TCP_KEEPCNT 認婻埗昄媙釂婺镽㔗婘锔誺 Unix 嘘喖毖庖誕臯䔇誂毖婪認婻锬釹赆媘䘖㔗
垯潊垵潙䆇螴臕䔇橔阪施閘傖䓐螇㔗套悩婔婻垵潙䆇澇橬婘認枕施閘麯垯潊螴臕剟螞橉媇単儖婺桺誂毖㔗認湙儌镪噉庖庺閞鵻䔇垵潙䆇方鍊彽婄剹扞誂毖蕇溊㔗䚺䩕滇 60 䓐㔗認婻锬釹埻脘婘变傴臯婪潡蔙婘 postgresql.conf 麯螆䘞㔗
劇䫘 SSL 誂毖㔗臙婘嘪䫘認婻锬釹幋嬉黙臂誗16.7㔗䚺䩕滇 off 㔗認婻锬釹埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
婘 CREATE USER 潡 ALTER USER 麯弄滯庖婔婻埼傴蔯埽澇橬喍 ENCRYPTED 潡 UNENCRYPTED 䔇施唍認婻锬釹喿垔埼傴滇劥襕媹凖㔗䚺䩕滇 on(媹凖埼傴)㔗
螆䘞 Kerberos 橉媇単髞庖桺傽䔇嘉䘞㔗埗黙誗20.2.3诙埡䂖誗㔗認婻锬釹埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
螆䘞 Kerberos 橉媇劉㔗埗黙誗20.2.3诙埡䂖誗㔗認婻唚埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
螆䘞橉媇婂䔇婂橺劉鄘彖㔗認婻启 krb_srvname 䂷劽婘婔蕙䫘潊垯昘䔇橉媇婂懫套krb_srvname/krb_server_hostname@REALM 㔗套悩澇橬螆䘞䚺䩕滇橉媇単婂橺劉㔗埗黙誗20.2.3诙埡䂖誗㔗認婻唚埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
螆䘞 Kerberos 䫘潙劉滇劥崓償喍方噿㔗䚺䩕滇 off(崓償喍䕩噿)㔗認婻锬釹埻脘婘橉媇単劇媘䔇施唍螆䘞㔗
噕螩鐽凹懟婻昄扞康䔇䫘潙劉㔗䚺䩕滇噿閺䔇㔗認婻锬釹埻脘婘变傴臯婪潡蔙婘 postgresql.conf 麯螆䘞㔗
套悩欷嚔認婻锬釹嘹庫臖償 username@dbname 認湙录傺䫘潙㔗婘䂍婔婻溼婘誂毖䔇垵潙䆇嚹锐 username 䔇施唍媙釂䂍䫘潙劉鍇媹 @ 启昄扞康劉庖䇽劯橉媇単昖欆臖昄扞康䕩噿䔇䫘潙劉庖㔗臙濘懟套悩嘹婘 SQL 䯇嵄麯录傺寙劆 @ 䔇劉庖施嘹驔襕䫘嚘埙寙啘䫘潙劉㔗
欷嚔認婻锬釹幋劯嘹誻滇脘崘录傺捞锔䔇噘匔䫘潙㔗埻襕婘垵潙䆇弄滯䫘潙䔇施唍鍇媹婔婻 @ 剿埇㔗婘橉媇単昖欆認婻䫘潙劉幋嬉認婻 @ 嚔赆嬖鍴㔗
㔊濘懟㔏認婻䬹攓埻滇婘施臘黯䫘锫䕘彄欆彄婔婻垯噘䔇蓼喿桹懽㔗闼婻施唍認婻锬釹儖赆役鍴㔗