Узлы не обнаружены в кластере OrientDB с Kubernetes - PullRequest
0 голосов
/ 25 октября 2018

Я использовал это руководство для настройки кластера OrientDB в Kubernetes.Однако кажется, что каждый узел в каждом модуле создает свой собственный кластер, а не присоединяется к общему.Таким образом, в журналах каждого модуля отображается следующее сообщение:

Members [1] {
    Member [pod-ip]:5701 - generated id
}

Что может вызвать такую ​​проблему?

Мой файл конфигурации orientdb-server-config выглядит следующим образом:

<handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
     <parameters>
          <parameter value="true" name="enabled"/>
          <parameter value="orientdb/config/default-distributed-db-config.json" name="configuration.db.default"/>
          <parameter value="orientdb/config/hazelcast.xml" name="configuration.hazelcast"/>
          <parameter name="nodeName" value="$pod_dns" />
     </parameters>
</handler>

Мой файл hazelcast.xml выглядит следующим образом (pod_dns - это имя модуля, хранящегося в env):

 </network>
    <properties>
        <property name="hazelcast.discovery.enabled">true</property>
    </properties>
    <network>
        <join>
            <multicast enabled="false"/>
            <tcp-ip enabled="false"/>
            <discovery-strategies>
                <discovery-strategy enabled="true"
                                    class="com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy">
                    <properties>
                        <property name="service-dns">pod_dns.default.svc.cluster.local</property>
                        <property name="service-dns-timeout">10</property>
                    </properties>
                </discovery-strategy>
            </discovery-strategies>
        </join>
    </network>

Kubernetes StatefulSet.Сценарии Bash для файлов hazelcast и orientdb-server-config монтируются и выполняются (для настройки обновления в зависимости от значения env для каждого модуля):

kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: orientdbservice
spec:
  serviceName: orientdbservice
  replicas: 3
  podManagementPolicy: Parallel
  selector:
    matchLabels:
      service: orientdb
      type: container-deployment
  template:
    metadata:
      labels:
        service: orientdb
        type: container-deployment
    spec:
      containers:
      - name: orientdbservice
        image: orientdb:2.2.36
        command: ["/bin/sh","-c", " cp /configs/* /orientdb/config/ ; chmod +x /orientdb/config/hazelcast_template.sh ; chmod +x /orientdb/config/server_config_template.sh ; sh /orientdb/config/hazelcast_template.sh ; sh /orientdb/config/server_config_template.sh ; /orientdb/bin/server.sh -Ddistributed=true" ]
        env:
        - name: ORIENTDB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: orientdb-password
              key: password.txt
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        ports:
        - containerPort: 2424
          name: port-binary
        - containerPort: 2480
          name: port-http
        - containerPort: 5701
          name: hazelcast
        volumeMounts:
        - name: config
          mountPath: /orientdb/config
        - name: orientdb-config-template-hazelcast
          mountPath: /configs/hazelcast_template.sh
          subPath: hazelcast_template.sh
        - name: orientdb-config-template-server
          mountPath: /configs/server_config_template.sh
          subPath: server_config_template.sh
        - name: orientdb-config-distributed
          mountPath: /configs/default-distributed-db-config.json
          subPath: default-distributed-db-config.json
        - name: orientdb-databases
          mountPath: /orientdb/databases
        - name: orientdb-backup
          mountPath: /orientdb/backup
      volumes:
      - name: config
        emptyDir: {}
      - name: orientdb-config-template-hazelcast
        configMap:
          name: orientdb-configmap-template-hazelcast
      - name: orientdb-config-template-server
        configMap:
          name: orientdb-configmap-template-server
      - name: orientdb-config-distributed
        configMap:
          name: orientdb-configmap-distributed
  volumeClaimTemplates:
  - metadata:
      name: orientdb-databases
      labels:
        service: orientdb
        type: pv-claim
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 20Gi
  - metadata:
      name: orientdb-backup
      labels:
        service: orientdb
        type: pv-claim
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 10Gi

1 Ответ

0 голосов
/ 06 ноября 2018

Проблема в конфигурации плагина Hazelcast0Kubernetes.Прежде всего, необходимо обновить версию OrientDB до последней версии - 3.0.10 со встроенной новейшей версией Hazelcast.Кроме того, я смонтировал файл зависимостей hazelcast-kubernetes.jar прямо в папку / orientdb / lib, и он начал работать правильно.Проблема была не в файлах конфигурации, а в настройке зависимостей для OrientDB.

...