A few tips on setting up an embedded OrientDB to run on OpenShift / Kubernetes cluster.
- Set the ORIENTDB_NODE_NAME system property or environment variable. If your database volumes are host volumes, you can use the downwards API spec.nodeName. If the node name contains dots, replace those with dashes for example. If you use something like OpenShift persistence volumes, make sure that the running pods ORIENTDB_NODE_NAME matches with the node name values it reads from the DB.
- Use at least 3 replicas and don't use even number due to split-brain clustering issues
- If you use rolling upgrade strategy, give the pods some time to start up the DBs so no more than one pod is unavailable at a time. This way syncing up the cluster status becomes smoother.
- Use the newNodeStrategy dynamic OrientDb distribution configuration parameter so unreachable nodes don't break up the write quorum so easily.
- Use Hazelcast to discover the cluster members. There is a library for that. If that does not work you might need to do a custom implementation using the Openshift / Kubernetes REST API and node labels to find all the members. This means calling the API from the container with a custom Hazelcast resolver
- If possible, create a liveness probe which checks if you can query a database. Avoid using writes since there is the danger of killing all pods due to unreachable quorum if multiple pods are down simultaneously.
Comments
Post a Comment