开发者社区> 问答> 正文

使用kubernetes kubeadm部署Neo4j集群

我用两个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...

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

展开
收起
k8s小能手 2018-12-14 16:17:25 4622 0
1 条回答
写回答
取消 提交回答
  • 整合最优质的专家资源和技术资料,问答解疑

    不太了解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"

    2019-07-17 23:21:08
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
ACK 云原生弹性方案—云原生时代的加速器 立即下载
ACK集群类型选择最佳实践 立即下载
企业运维之云原生和Kubernetes 实战 立即下载

相关镜像