I have OrientDB database set up in a distributed mode with Kubernetes. I defined PersistentVolumeClaims in a StatefulSet in such a way:
volumeClaimTemplates:
- metadata:
name: orientdb-databases
labels:
service: orientdb
type: pv-claim
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 40Gi
- metadata:
name: orientdb-backup
labels:
service: orientdb
type: pv-claim
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 20Gi
When I do not define PersistentVolumes they are created with generic name and the cluster works as expected. However, when I define my own PersistentVolumes pods start to crash and I get such errors:
[org.xml.sax.SAXParseException; systemId: file:/orientdb/config/orientdb-server-config.xml; lineNumber: 89; columnNumber: 22; The processing instruction target matching "[xX][mM][lL]" is not allowed.]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
<network>
<protocols>
<protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
</protocols>
<listeners>
<listener protocol="binary" socket="default" port-range="2424-2430" ip-address="127.0.0.1"/>
</listeners>
</network>
<storages/>
<security>
<users/>
<resources/>
</security>
<isAfterFirstTime>false</isAfterFirstTime>
</orient-server>
I checked my orient-server-config.xml file and I can see the reason for such behavior. I generate this config file with a bash script:
</network>
<storages>
</storages>
<users>
</users>
<properties>
<entry value=\"1\" name=\"db.pool.min\"/>
<entry value=\"50\" name=\"db.pool.max\"/>
<entry value=\"true\" name=\"profiler.enabled\"/>
</properties>
</orient-server>
And that's how it looks like on the pod:
<storages/>
<users>
<user resources="*" password="{password}" name="root"/>
<user resources="connect,server.listDatabases,server.dblist" password="{password}" name="guest"/>
</users>
<properties>
<entry value="1" name="db.pool.min"/>
<entry value="50" name="db.pool.max"/>
<entry value="true" name="profiler.enabled"/>
</properties>
<isAfterFirstTime>true</isAfterFirstTime>
</orient-server>
How can I fix this error?
Here is how I defined PersistentVolumes. As I have 3 nodes and 2 volumes for each of them the name of the volume and the name of the host path directory only changes by the number (from 1 to 6):
apiVersion: v1
kind: PersistentVolume
metadata:
name: "pv-db-1"
labels:
service: orientdb
type: local
spec:
storageClassName: standard
capacity:
storage: "40Gi"
accessModes:
- "ReadWriteOnce"
hostPath:
path: /orientdb-volumes/databases-1
persistentVolumeReclaimPolicy: Delete
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: "pv-backup-1"
labels:
service: orientdb
type: local
spec:
storageClassName: standard
capacity:
storage: "20Gi"
accessModes:
- "ReadWriteOnce"
hostPath:
path: /orientdb-volumes/databases-2
persistentVolumeReclaimPolicy: Delete