首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于HA (Neo.ClientError.Transaction.TransactionNotFound)的Neo4j HA

基于HA (Neo.ClientError.Transaction.TransactionNotFound)的Neo4j HA
EN

Stack Overflow用户
提问于 2016-09-07 10:54:09
回答 1查看 364关注 0票数 0

我使用的是螺栓协议的AWS集群中的新4j-Enterprise3.0.4。我使用HAproxy来知道谁是主人,谁是HA集群中的奴隶。

这是我的HAproxy haproxy.cfg的设置

代码语言:javascript
复制
global
   log 127.0.0.1 local0
   log 127.0.0.1 local1 notice
   chroot /var/lib/haproxy
   stats socket /run/haproxy/admin.sock mode 660 level admin
   stats timeout 30s
   user haproxy
   group haproxy
   daemon
   maxconn 256
defaults
    log global
    mode tcp
    option tcplog
    option dontlognull
    timeout connect 30s
    timeout client 2h
    timeout server 2h
frontend http-in
    bind *:81
    acl write_method method POST DELETE PUT
    acl write_hdr hdr_val(X-Write) eq 1
    acl write_payload payload(0,0) -m reg -i CREATE|MERGE|SET|DELETE|REMOVE
    acl tx_cypher_endpoint path_beg /db/data/transaction
    http-request set-var(txn.tx_cypher_endpoint) bool(true) if tx_cypher_endpoint
    use_backend neo4j-master if write_hdr
    use_backend neo4j-master if tx_cypher_endpoint write_payload
    use_backend neo4j-all if tx_cypher_endpoint
    use_backend neo4j-master if write_method
    default_backend neo4j-all
backend neo4j-all
    option httpchk GET /db/manage/server/ha/available HTTP/1.0\r\nAuthorization:\ Basic\ [code]
    acl tx_cypher_endpoint var(txn.tx_cypher_endpoint),bool
    stick-table type integer size 1k expire 70s  # slightly higher with org.neo4j.server.transaction.timeout
    stick match path,word(4,/) if tx_cypher_endpoint
    stick store-response hdr(Location),word(6,/) if tx_cypher_endpoint
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
backend neo4j-master
    option httpchk GET /db/manage/server/ha/master HTTP/1.0\r\nAuthorization:\ Basic\ [code]
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
listen admin
    bind *:82
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Haproxy\ Statistics
    stats auth admin:admin

有时,当我想在浏览器中使用密码时,我就会得到它。

代码语言:javascript
复制
"errors": [
    {
      "code": "Neo.ClientError.Transaction.TransactionNotFound",
      "message": "Unrecognized transaction id. Transaction may have timed out and been rolled back."
    }
  ]

此外,我尝试了这个HAproxy配置,但我仍然有同样的问题。这是我的第二个HAproxy haproxy.cfg的设置

代码语言:javascript
复制
global
   log 127.0.0.1 local0
   log 127.0.0.1 local1 notice
   chroot /var/lib/haproxy
   stats socket /run/haproxy/admin.sock mode 660 level admin
   stats timeout 30s
   user haproxy
   group haproxy
   daemon
   maxconn 256
defaults
    log global
    mode tcp
    option tcplog
    option dontlognull
    timeout connect 30s
    timeout client 2h
    timeout server 2h
frontend http-in
    bind *:81
    acl write_method method POST DELETE PUT
    acl write_hdr hdr_val(X-Write) eq 1
    acl write_payload payload(0,0) -m reg -i CREATE|MERGE|SET|DELETE|REMOVE
    acl tx_cypher_endpoint path_beg /db/data/transaction
    http-request set-var(txn.tx_cypher_endpoint) bool(true) if tx_cypher_endpoint
    use_backend neo4j-master if write_hdr
    use_backend neo4j-master if tx_cypher_endpoint write_payload
    use_backend neo4j-all if tx_cypher_endpoint
    use_backend neo4j-master if write_method
    default_backend neo4j-all
backend neo4j-all
    option httpchk GET /db/manage/server/ha/master HTTP/1.0\r\nAuthorization:\ Basic\ [code]
    acl tx_cypher_endpoint var(txn.tx_cypher_endpoint),bool
    stick-table type integer size 1k expire 70s  # slightly higher with org.neo4j.server.transaction.timeout
    stick match path,word(4,/) if tx_cypher_endpoint
    stick store-response hdr(Location),word(6,/) if tx_cypher_endpoint
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
backend neo4j-master
    option httpchk GET /db/manage/server/ha/slave HTTP/1.0\r\nAuthorization:\ Basic\ [code]
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
listen admin
    bind *:82
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Haproxy\ Statistics
    stats auth admin:admin

所以我不知道为什么会这样。这是因为HAproxyAWSBolt。当我在http上切换协议时,一切都运行良好,并且没有错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-08 10:00:57

我通过在HAproxy .cfg中添加以下参数来解决这个问题:

后端新4j浏览器,带有模式,http,选项,首选-最后服务器。现在,HAproxy作为charme工作,我再也不会收到错误了。

代码语言:javascript
复制
global
   log 127.0.0.1 local0
   log 127.0.0.1 local1 notice
   chroot /var/lib/haproxy
   stats socket /run/haproxy/admin.sock mode 660 level admin
   stats timeout 30s
   user haproxy
   group haproxy
   daemon
   maxconn 256
defaults
    log global
    mode tcp
    option tcplog
    option dontlognull
    timeout connect 30s
    timeout client 2h
    timeout server 2h
frontend http-in
    bind *:81
    acl write_method method POST DELETE PUT
    acl write_hdr hdr_val(X-Write) eq 1
    acl write_payload payload(0,0) -m reg -i CREATE|MERGE|SET|DELETE|REMOVE
    acl tx_cypher_endpoint path_beg /db/data/transaction
    http-request set-var(txn.tx_cypher_endpoint) bool(true) if tx_cypher_endpoint
    use_backend neo4j-master if write_hdr
    use_backend neo4j-master if tx_cypher_endpoint write_payload
    use_backend neo4j-all if tx_cypher_endpoint
    use_backend neo4j-master if write_method
    default_backend neo4j-all
frontend http-browse
    bind *:83
    mode http
    default_backend neo4j-browser
backend neo4j-all
    option httpchk GET /db/manage/server/ha/available HTTP/1.0\r\nAuthorization:\ Basic\[code]
    acl tx_cypher_endpoint var(txn.tx_cypher_endpoint),bool
    stick-table type integer size 1k expire 70s  # slightly higher with org.neo4j.server.transaction.timeout
    stick match path,word(4,/) if tx_cypher_endpoint
    stick store-response hdr(Location),word(6,/) if tx_cypher_endpoint
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
backend neo4j-master
    option httpchk GET /db/manage/server/ha/master HTTP/1.0\r\nAuthorization:\ Basic\[code]
    server neo4j-1 192.0.0.250:7687 check port 7474
    server neo4j-2 192.0.0.251:7687 check port 7474
    server neo4j-3 192.0.0.252:7687 check port 7474
backend neo4j-browser
    mode http
    option prefer-last-server
    option httpchk GET /db/manage/server/ha/master HTTP/1.0\r\nAuthorization:\ Basic\ [code]
    server neo4j-1 192.0.0.250:7474 check
    server neo4j-2 192.0.0.251:7474 check
    server neo4j-3 192.0.0.252::7474 check
listen admin
    bind *:82
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Haproxy\ Statistics
    stats auth admin:admin
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39367964

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档