使用kubernetes kubeadm部署Neo4j集群-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

使用kubernetes kubeadm部署Neo4j集群

2018-12-14 16:17:25 3600 1

我用两个VM构建了一个集群,其中一个是master,另一个是worker。
工人成功加入了主人。在主机中,我这样做

kubectl apply -f cores
与指南相似。以下是cores.yaml它包含的文件:

1)Statefulset.yaml:

apiVersion: "apps/v1beta1"
kind: StatefulSet
metadata:
name: neo4j-core
spec:
serviceName: neo4j
replicas: 3
template:

metadata:
  labels:
    app: neo4j
    component: core
spec:
  containers:
  - name: neo4j
    image: "neo4j:3.3.2-enterprise"
    imagePullPolicy: "IfNotPresent"
    env:
      - name: NEO4J_dbms_mode
        value: CORE
      - name: NUMBER_OF_CORES
        value: "3"
      - name: NEO4J_dbms_security_auth__enabled
        value: "false"
      - name: NEO4J_causal__clustering_discovery__type
        value: DNS
      - name: NEO4J_causal__clustering_initial__discovery__members
        value: "neo4j.default.svc.cluster.local:5000"
      - name: NEO4J_ACCEPT_LICENSE_AGREEMENT
        value: "yes"
    command:
      - "/bin/bash"
      - "-ecx"
      - |
        export NEO4J_dbms_connectors_default__advertised__address=$(hostname -f)
    export 

NEO4J_causal__clustering_discovery__advertised__address=$(hostname -
f):5000

        export NEO4J_causal__clustering_transaction__advertised__address=$(hostname -f):6000
        export NEO4J_causal__clustering_raft__advertised__address=$(hostname -f):7000
        exec /docker-entrypoint.sh "neo4j"
    ports:
    - containerPort: 5000
      name: discovery
    - containerPort: 7000
      name: raft
    - containerPort: 6000
      name: tx
    - containerPort: 7474
      name: browser
    - containerPort: 7687
      name: bolt
    - containerPort: 6362
      name: backup
    securityContext:
      privileged: true
    volumeMounts:
    - name: datadir
      mountPath: "/data"

volumeClaimTemplates:

- metadata:
    name: datadir
  spec:
    accessModes:
      - ReadWriteOnce
    storageClassName: "standard"
    resources:
      requests:
        storage: "10Gi"

2)dns.yaml:

apiVersion: v1
kind: Service
metadata:
name: neo4j
labels:

app: neo4j
component: core

spec:
clusterIP: None
ports:

- port: 7474
  targetPort: 7474
  name: browser
- port: 6362
  targetPort: 6362
  name: backup

selector:

app: neo4j
component: core

然后当我这样做时:

kubectl logs -l "app=neo4j"
而不是看到以下行:

2017-09-13 09:41:39.562+0000 INFO Remote interface available at
http://neo4j-core-2.neo4j.default.svc.cluster.local:7474/
Cores 不再与其他members链接:

++ hostname -f

  • export NEO4J_dbms_connectors_default__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local
  • NEO4J_dbms_connectors_default__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local
    ++ hostname -f
  • export NEO4J_causal__clustering_discovery__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:5000
  • NEO4J_causal__clustering_discovery__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:5000
    ++ hostname -f
  • export NEO4J_causal__clustering_transaction__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:6000
  • NEO4J_causal__clustering_transaction__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:6000
    ++ hostname -f
  • export NEO4J_causal__clustering_raft__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:7000
  • NEO4J_causal__clustering_raft__advertised__address=neo4j-core-0.neo4j.default.svc.cluster.local:7000
  • exec /docker-entrypoint.sh neo4j
    Active database: graph.db

Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /var/lib/neo4j/logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
2018-10-29 14:38:01.268+0000 INFO ======== Neo4j 3.3.2 ========
2018-10-29 14:38:01.359+0000 INFO Starting...
2018-10-29 14:38:03.680+0000 INFO Bolt enabled on 0.0.0.0:7687.
2018-10-29 14:38:03.715+0000 INFO Initiating metrics...
2018-10-29 14:38:04.021+0000 INFO Resolved initial host
'neo4j.neo4j.svc.cluster.local:5000' to []
2018-10-29 14:38:04.095+0000 INFO My connection info: [

    Discovery:   listen=0.0.0.0:5000, advertised=neo4j-core-0.neo4j.default.svc.cluster.local:5000,
    Transaction: listen=0.0.0.0:6000, advertised=neo4j-core-0.neo4j.default.svc.cluster.local:6000, 
    Raft:        listen=0.0.0.0:7000, advertised=neo4j-core-0.neo4j.default.svc.cluster.local:7000, 
    Client Connector Addresses: bolt://neo4j-core-0.neo4j.default.svc.cluster.local:7687,http://neo4j-core-0.neo4j.default.svc.cluster.local:7474,https://neo4j-core-0.neo4j.default.svc.cluster.local:7473

]

2018-10-29 14:38:04.095+0000 INFO  Discovering cluster with initial members: [neo4j.neo4j.svc.cluster.local:5000]
2018-10-29 14:38:04.095+0000 INFO  Attempting to connect to the other cluster members before continuing...

它停留在最后一行不再继续,也没有引发故障错误!出什么问题了?

取消 提交回答
全部回答(1)
  • k8s小能手
    2019-07-17 23:21:08

    不太了解neo4j,我的猜测是neo4j找不到members本身。

    由于您运行3个副本,我猜你需要在initial__discovery__members变量中添加预期members fqdn。

    -name: NEO4J_causal__clustering_initial__discovery__members
    -value: "neo4j-core-0.neo4j.default.svc.cluster.local:5000, neo4j-core-1.neo4j.default.svc.cluster.local:5000,neo4j-core-2.neo4j.default.svc.cluster.local:5000"

    0 0
相关问答

22

回答

阿里云搭建VPN ,可以连接VPN,但是无法访问外网

斐济被 2017-04-10 10:18:11 89738浏览量 回答数 22

170

回答

惊喜翻倍:免费ECS+免费环境配置~!(ECS免费体验6个月活动3月31日结束)

豆妹 2014-10-29 17:52:21 233764浏览量 回答数 170

59

回答

为阿里云ECS(CentOS7)配置IPv6隧道地址

dongshan8 2016-06-17 13:51:32 107524浏览量 回答数 59

24

回答

阿里云开放端口权限

xcxx 2016-07-20 15:03:33 660311浏览量 回答数 24

39

回答

安全组详解,新手必看教程

我的中国 2017-11-30 15:23:46 263612浏览量 回答数 39

105

回答

为阿里云ECS(Windows 2012)创建IPv6隧道地址

dongshan8 2016-06-09 16:40:16 104130浏览量 回答数 105

23

回答

【云服务器分享】网站访问速度快才是硬道理

dreamdoo 2012-10-15 10:15:02 86562浏览量 回答数 23

11

回答

【精品问答合集】MongoDB热门问答

李博 bluemind 2019-05-29 16:50:19 123483浏览量 回答数 11

13

回答

【精品问答合集】Java热门问答

李博 bluemind 2019-05-29 16:00:45 129302浏览量 回答数 13

37

回答

【云服务器教程征集令】这个六一阿里云邀您来吐槽!

fanyue88888 2012-06-01 18:55:41 114945浏览量 回答数 37
+关注
k8s小能手
整合最优质的专家资源和技术资料,问答解疑
26
文章
620
问答
问答排行榜
最热
最新
相关电子书
更多
JS零基础入门教程(上册)
立即下载
性能优化方法论
立即下载
手把手学习日志服务SLS,云启实验室实战指南
立即下载