我使用Kubernetes在分布式模式下设置了OrientDB数据库。我以这种方式在StatefulSet中定义了PersistentVolumeClaims:
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
当我不定义PersistentVolumes时,它们是用通用名称创建的,并且群集按预期工作。但是,当我定义自己的PersistentVolumes窗格时,它们开始崩溃,并出现以下错误:
[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>
我检查了orient-server-config.xml文件,可以看到这种现象的原因。我使用bash脚本生成此配置文件:
</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>
这就是豆荚上的样子:
<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>
如何解决此错误?
这是我定义PersistentVolumes的方式。因为我有3个节点和2个卷,所以每个卷的名称和主机路径目录的名称仅按数字更改(从1到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