開發一個專案使用sharding-proxy,使用mysql資料庫,但是專案運行后經常會出現READ ONLY transaction的錯誤提示。如果不用sharding-proxy,應用直接連接資料庫,則不會出現這種錯誤,不知道問題在哪,下面是我的sharding-proxy的對應配置資訊:
config-sharding.yaml
schemaName: aaa
dataSources:
ds_0:
url: jdbc:mysql://127.0.0.1:33306/aaa?useLocalSessionState=true&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: root
password: 111111
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 180000
maxPoolSize: 50
shardingRule:
tables:
aa_info:
actualDataNodes: ds_0.aa_info_${0..19}
tableStrategy:
inline:
shardingColumn: id
algorithmExpression: aa_info_${id % 20}
bindingTables:
- aa_info
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
server.yaml檔案
authentication:
users:
root:
password: 111111
authorizedSchemas: aaa
props:
max.connections.size.per.query: 20
acceptor.size: 16 # The default value is available processors count * 2.
executor.size: 16 # Infinite by default.
proxy.frontend.flush.threshold: 128 # The default value is 128.
# LOCAL: Proxy will run with LOCAL transaction.
# XA: Proxy will run with XA transaction.
# BASE: Proxy will run with B.A.S.E transaction.
proxy.transaction.type: LOCAL
proxy.opentracing.enabled: false
proxy.hint.enabled: false
query.with.cipher.column: false
sql.show: false
allow.range.query.with.inline.sharding: true
系統在一定概率上出現以上問題,感覺是上一個操作還沒操作完,下一個操作就會提示只讀的錯誤,不知道應該如何配置才能解決這種問題,求大神指點
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/73279.html
標籤:Apache
上一篇:如何用js判斷某時間段按鈕可用?
