我用两个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
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...
它停留在最后一行不再继续,也没有引发故障错误!出什么问题了?
不太了解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"
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。