Browse Source

add es2.4.6 cluster

Your Name 6 years ago
parent
commit
0b2012d111

+ 3 - 0
es-2.4.6-cluster/es/Dockerfile

@@ -0,0 +1,3 @@
+FROM dotbalo/es:2.4.6
+
+COPY ./elasticsearch.yml /usr/share/elasticsearch/config/

+ 19 - 0
es-2.4.6-cluster/es/elasticsearch.yml

@@ -0,0 +1,19 @@
+cluster.name: ${CLUSTER_NAME}
+
+
+path.data: /usr/share/elasticsearch/data
+
+network.host: 0.0.0.0
+
+index.analysis.analyzer.default.type: ik
+
+node.name: ${NODE_NAME}
+node.master: true
+node.data: true
+
+discovery.zen.minimum_master_nodes: ${MINIMUM_MASTER_NODES}
+
+xpack.security.enabled: false
+xpack.monitoring.enabled: false
+discovery.zen.ping.unicast.hosts: ["es-cluster-0.elasticsearch", "es-cluster-1.elasticsearch", "es-cluster-2.elasticsearch"] 
+

+ 87 - 0
es-2.4.6-cluster/es/es-sts-2.4.4.yaml

@@ -0,0 +1,87 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: es-cluster
+spec:
+  serviceName: elasticsearch
+  replicas: 3
+  selector:
+    matchLabels:
+      app: elasticsearch
+  template:
+    metadata:
+      labels:
+        app: elasticsearch
+    spec:
+      volumes:
+      - name: data
+        emptyDir: {}
+      containers:
+      - name: elasticsearch
+        #image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3
+        image: dotbalo/es:2.4.6-cluster
+        imagePullPolicy: Always
+        resources:
+            limits:
+              cpu: 1000m
+            requests:
+              cpu: 100m
+        ports:
+        - containerPort: 9200
+          name: rest
+          protocol: TCP
+        - containerPort: 9300
+          name: inter-node
+          protocol: TCP
+        volumeMounts:
+        - name: data
+          mountPath: /usr/share/elasticsearch/data
+        env:
+          - name: "cluster.name"
+            value: "pscm-cluster"
+          - name: "CLUSTER_NAME"
+            value: "pscm-cluster"
+          - name: "discovery.zen.minimum_master_nodes"
+            value: "2"
+          - name: "MINIMUM_MASTER_NODES"
+            value: "2"
+          - name: "node.name"
+            valueFrom:
+              fieldRef:
+                fieldPath: metadata.name
+          - name: "NODE_NAME"
+            valueFrom:
+              fieldRef:
+                fieldPath: metadata.name
+          - name: "discovery.zen.ping.unicast.hosts"
+            value: "es-cluster-0.elasticsearch, es-cluster-1.elasticsearch, es-cluster-2.elasticsearch"
+          #- name: ES_JAVA_OPTS
+          #  value: "-Xms512m -Xmx512m"
+      initContainers:
+      - name: fix-permissions
+        image: busybox
+        command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
+        securityContext:
+          privileged: true
+        volumeMounts:
+        - name: data
+          mountPath: /usr/share/elasticsearch/data
+      - name: increase-vm-max-map
+        image: busybox
+        command: ["sysctl", "-w", "vm.max_map_count=262144"]
+        securityContext:
+          privileged: true
+      - name: increase-fd-ulimit
+        image: busybox
+        command: ["sh", "-c", "ulimit -n 65536"]
+        securityContext:
+          privileged: true
+#  volumeClaimTemplates:
+#  - metadata:
+#      name: data
+#    spec:
+#      accessModes: [ "ReadWriteOnce" ]
+#      storageClassName: "es-storage-class"
+#      resources:
+#        requests:
+#          storage: 10Gi

+ 15 - 0
es-2.4.6-cluster/es/es-svc-2.4.4.yaml

@@ -0,0 +1,15 @@
+kind: Service
+apiVersion: v1
+metadata:
+  name: elasticsearch
+  labels:
+    app: elasticsearch
+spec:
+  selector:
+    app: elasticsearch
+  clusterIP: None
+  ports:
+    - port: 9200
+      name: rest
+    - port: 9300
+      name: inter-node