helm安装neo4j集群

此处忽略k8s以及helm的安装。。。。

(1)查找neo4j安装包

helm search neo4j
NAME            CHART VERSION   APP VERSION     DESCRIPTION                                
incubator/neo4j 0.3.0           3.2.3           Neo4j is the world's leading graph database
stable/neo4j    0.8.0           3.4.5           Neo4j is the world's leading graph database

(2)查看安装包配置项

helm inspect incubator/neo4j
可支持Causal cluster集群

(3)获取安装包
helm fetch stable/neo4j

(4)解压安装包
tar -xvzf neo4j-0.8.0.tgz && cd neo4j/

(5)创建storgeclass
vim nfs-client-class-neo4j.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: neo4j-nfs-storage
provisioner: fuseim.pri/ifs  # or choose another name, must match deployment's env PROVISIONER_NAME'

fuseim.pri/ifs是provisioner,如何创建provisioner,自行查找,资料较多,使用storgeclass是一种动态创建PV以及PVC的方式。

创建:
kubectl create -f  nfs-client-class-neo4j.yaml
storageclass.storage.k8s.io "neo4j-nfs-storage" created
查看:
kubectl get storageclass
NAME                          PROVISIONER       AGE
neo4j-nfs-storage             fuseim.pri/ifs    49s

(6)配置storageclass

vim values.yaml
core:
  numberOfServers: 3
  persistentVolume:
    mountPath: /data
    size: 20Gi
    storageClass: "neo4j-nfs-storage"

storageClass指向刚才创建的storageclass的名称。

(7)配置neo4j参数

若需要修改neo4j的配置,通过以下步骤修改:

在templates/core-statefulset.yaml、templates/readreplicas-deployment.yaml通过在command:下添加类似于如下以NEO4J_为开头的内容来添加:
export NEO4J_dbms_shell_enabled=true
或者在containers下添加例如如下内容:
- name: NEO4J_dbms_shell_enabled
 value: "true"

(8)安装neo4j

helm install ./neo4j --name neo4j    (注意:这里不要指定neo4j的namespace,因为neo4j的charts包里将namespace默认写在在default下,若指定namespace,需要去neo4j/templates/core-statefulset.yaml等文件中将default改成neo4j)

NAME:   neo4j
LAST DEPLOYED: Mon Jan  7 17:12:54 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Secret
NAME                 AGE
neo4j-neo4j-secrets  0s

==> v1/ConfigMap
neo4j-neo4j-tests  0s

==> v1/Service
neo4j-neo4j  0s

==> v1beta1/Deployment
neo4j-neo4j-replica  0s

==> v1beta1/StatefulSet
neo4j-neo4j-core  0s

==> v1/Pod(related)

NAME                READY  STATUS             RESTARTS  AGE
neo4j-neo4j-core-0  0/1    ContainerCreating  0         0s


NOTES:
We'll need to wait a few seconds for the Neo4j cluster to form.
We need to see this line in all of our pods' logs:

> Remote interface available at http://neo-helm-neo4j-core-2.neo-helm-neo4j.default.svc.cluster.local:7474/

We can see the content of the logs by running the following command:

kubectl logs -l "app=neo4j,component=core"

We can now run a query to find the topology of the cluster.

kubectl run -it --rm cypher-shell \
    --image=neo4j:3.2.3-enterprise \
    --restart=Never \
    --namespace default \
    --command -- ./bin/cypher-shell -u neo4j -p <password> --a neo4j-neo4j.default.svc.cluster.local "call dbms.cluster.overview()"

This will print out the addresses of the members of the cluster.

Note:
You'll need to substitute <password> with the password you set when installing the Helm package.
If you didn't set a password, one will be auto generated.
You can find the base64 encoded version of the password by running the following command:

kubectl get secrets neo4j-neo4j-secrets -o yaml

(9)验证

登录其中一台
kubectl exec -ti neo4j-neo4j-core-1  -- bash
./bin/cypher-shell
username: neo4j
password: **********        //密码请查看/var/lib/neo4j/conf/neo4j.conf文件的最后一行
neo4j> CREATE (n:Person {name: "dahua", age: 18});
neo4j> MATCH (a:Person) return a;
+------------------------------------+
| a                                  |
+------------------------------------+
| (:Person {name: "dahua", age: 18}) |
+------------------------------------+

PS

下方是我个人订阅号,会一直更新各类技术文章,欢迎关注  :)

猜你喜欢

转载自blog.csdn.net/u014036123/article/details/86059406