簡體   English   中英

PostgreSQL演變:“PSQLException:致命:抱歉,已經有太多客戶”

[英]PostgreSQL Evolutions: “PSQLException: FATAL: sorry, too many clients already”

我正在嘗試建立一個開發PostgreSQL服務器。 它正在運行,我可以從命令行創建角色,表等。 但是當我嘗試使用Play應用evolution時,我收到以下錯誤:

org.postgresql.util.PSQLException: FATAL: sorry, too many clients already

我能夠連接,如果我故意輸入語法錯誤,它會返回語法錯誤,所以我知道Play能夠連接到數據庫。 但是,在演變成功應用后,我得到上面顯示的錯誤。

我對PostgreSQl管理並不十分精通,所以我不確定問題是Play還是我的PostgreSQL安裝。 我剛剛在運行Mountain Lion的Mac上使用Heroku的Postgres.app安裝它。

這是寫入控制台的內容:

! @6cnb0blpp - Internal server error, for request [GET /] ->

play.api.db.evolutions.InvalidDatabaseRevision: Database 'default' needs evolution! [An SQL script need to be run on your database.]
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:427) ~[play_2.9.1.jar:2.0.4]
    at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:448) ~[play_2.9.1.jar:2.0.4]
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:414) ~[play_2.9.1.jar:2.0.4]
    at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:412) ~[play_2.9.1.jar:2.0.4]
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.3]
    at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.3]
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 10. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 9. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 8. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 7. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 6. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 5. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 4. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 3. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 2. Exception: null
[error] c.j.b.h.AbstractConnectionHook - Failed to acquire connection Sleeping for 1000ms and trying again. Attempts left: 1. Exception: null
[error] application - 

謝謝!

允許的連接數在postgresql.conf使用GUC(“Grand Unified Configuration”) max_connections 默認值為100。

但是,在你修改設置之前,你必須問自己:在你的集群達到極限之前,所有其他100個連接的來源是什么? 這通常指向您的安裝或程序中的錯誤!

您可能還對連接池本文關於 Postgres Wiki中的連接數感興趣。

Postgres.app默認為max_connections = 10.請參閱~/Library/Application Support/Postgres/var/postgresql.conf

我通過將max_connections增加到50來修復此問題。在Mountain Lion上,我還必須將shared_buffers減少到500kB才能啟動Postgres。

您可以減少應用程序使用的連接數。 在mac安裝上有相同的錯誤。 官方文檔所示:

db.default.partitionCount=2

# The number of connections to create per partition. Setting this to 
# 5 with 3 partitions means you will have 15 unique connections to the 
# database. Note that BoneCP will not create all these connections in   
# one go but rather start off with minConnectionsPerPartition and 
# gradually increase connections as required.
db.default.maxConnectionsPerPartition=5

# The number of initial connections, per partition.
db.default.minConnectionsPerPartition=5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM