Elasticsearch 5.5.3+Kubernetes
28628 단어 kubernetesElasticsearch
Elasticsearch 5.5.3+Kubernetes
그룹 모드의elasticsearchusermemlock 문제 해결
미러 버전:
registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v12
es 공식 제공 거울 docker.elastic.co/elasticsearch/elasticsearch:5.5.3은elasticsearch 사용자를bootstrapuser로 합니다. 용기가 시작될 때ulimit-l를 통해memlock을 unlimited로 수정할 수 없기 때문에bootstrap을 설정할 수 없습니다.memory_lock:true를 시작할 때 실패했습니다.
dockerfile에서 USER root를 사용하고 ENTRYPOINT에서 사용해야 합니다.chown -R elasticsearch:elasticsearch "$path"
exec gosu elasticsearch $@
미러링에 대한 소스 코드:https://github.com/hy9418/elasticsearch.git
우리의 아리운 거울 주소를 직접 사용할 수 있다docker pull registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v12
플러그인 설치
미러 버전:
registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v13
chown -R elasticsearch:elasticsearch "$path"
exec gosu elasticsearch $@
docker pull registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v12
RUN elasticsearch-plugin install x-pack && \
elasticsearch-plugin install analysis-icu && \
elasticsearch-plugin install analysis-phonetic && \
elasticsearch-plugin install analysis-smartcn
git clone https://github.com/medcl/elasticsearch-analysis-ik.git
git clone https://github.com/medcl/elasticsearch-analysis-pinyin.git
프로젝트에 들어간 후 5.5.3 버전 태그로 전환하여 패키지 컴파일하기
git checkout v5.5.3
mvn clean package
미러에 압축 풀기
COPY pinyin /usr/share/elasticsearch/plugins/pinyin
COPY ik /usr/share/elasticsearch/plugins/ik
configmap을 사용하여 elasticsearch를 설정합니다.yml
미러 버전:
registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v14
런을 추가합니다.sh
ulimit -l unlimited
if [ -d /configmap ]; then
for z in /configmap/*.yml; do
cat $z >> /usr/share/elasticsearch/config/elasticsearch.yml
done
fi
set -- elasticsearch "$@"
/docker-entrypoint.sh "$@"
마스터 노드 configmap:
apiVersion: v1
data:
elasticsearch.yml: |
cluster.name: elasticsearch-cluster
bootstrap.memory_lock: true
discovery.zen.ping.unicast.hosts: elasticsearch-cluster-discovery
node.master: true
node.data: false
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping_timeout: 5s
node.ingest: true
transport.tcp.port: 9300
transport.host: 0.0.0.0
kind: ConfigMap
metadata:
name: elasticsearch-master-configmap
namespace: ns-elastic
데이터 노드 configmap:
apiVersion: v1
data:
elasticsearch.yml: |
cluster.name: elasticsearch-cluster
bootstrap.memory_lock: true
discovery.zen.ping.unicast.hosts: elasticsearch-cluster-discovery
node.master: false
node.data: true
node.ingest: true
discovery.zen.ping_timeout: 5s
transport.host: 0.0.0.0
kind: ConfigMap
metadata:
name: elasticsearch-data-configmap
namespace: ns-elastic
사용 시작
클러스터 모드
kind: Deployment
apiVersion: apps/v1beta2
metadata:
labels:
elastic-app: elasticsearch-cluster
role: master
name: elasticsearch-master
namespace: ns-elastic
spec:
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
elastic-app: elasticsearch-cluster
role: master
template:
metadata:
labels:
elastic-app: elasticsearch-cluster
role: master
spec:
containers:
- name: elasticsearch-master
image: registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v14
volumeMounts:
- name: elasticsearch-master-configmap
mountPath: /configmap
ports:
- containerPort: 9200
protocol: TCP
- containerPort: 9300
protocol: TCP
env:
- name: "ES_JAVA_OPTS"
value: "-Xms512m -Xmx512m"
securityContext:
privileged: true
volumes:
- name: elasticsearch-master-configmap
configMap:
name: elasticsearch-master-configmap
---
kind: Service
apiVersion: v1
metadata:
labels:
elastic-app: elasticsearch-cluster
name: elasticsearch-cluster-discovery
namespace: ns-elastic
spec:
ports:
- port: 9300
targetPort: 9300
selector:
elastic-app: elasticsearch-cluster
role: master
---
kind: Deployment
apiVersion: apps/v1beta2
metadata:
labels:
elastic-app: elasticsearch-cluster
role: data
name: elasticsearch-data
namespace: ns-elastic
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
elastic-app: elasticsearch-cluster
template:
metadata:
labels:
elastic-app: elasticsearch-cluster
role: data
spec:
containers:
- name: elasticsearch-data
image: registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v14
ports:
- containerPort: 9200
protocol: TCP
- containerPort: 9300
protocol: TCP
volumeMounts:
- name: elasticsearch
mountPath: /usr/share/elasticsearch/data
- name: elasticsearch-data-configmap
mountPath: /configmap
env:
- name: "ES_JAVA_OPTS"
value: "-Xms512m -Xmx512m"
securityContext:
privileged: true
volumes:
- name: elasticsearch
emptyDir: {}
- name: elasticsearch-data-configmap
configMap:
name: elasticsearch-data-configmap
---
kind: Service
apiVersion: v1
metadata:
labels:
elastic-app: elasticsearch-cluster-nodeport
name: elasticsearch-cluster-nodeport
namespace: ns-elastic
spec:
ports:
- port: 9200
targetPort: 9200
selector:
elastic-app: elasticsearch-cluster
type: NodePort
단일 모드
kind: Deployment
apiVersion: apps/v1beta2
metadata:
labels:
elastic-app: elasticsearch-simple
name: elasticsearch-simple
namespace: ns-elastic
spec:
replicas: 1
revisionHistoryLimit: 4
selector:
matchLabels:
elastic-app: elasticsearch-simple
template:
metadata:
labels:
elastic-app: elasticsearch-simple
spec:
containers:
- name: elasticsearch-simple
image: registry.cn-hangzhou.aliyuncs.com/fugle/elasticsearch:v13
ports:
- containerPort: 9200
protocol: TCP
- containerPort: 9300
protocol: TCP
volumeMounts:
- name: elasticsearch-simple
mountPath: /usr/share/elasticsearch/data
env:
- name: "ES_JAVA_OPTS"
value: "-Xms512m -Xmx512m"
securityContext:
privileged: true
volumes:
- name: elasticsearch-simple
persistentVolumeClaim:
claimName: elasticsearch-simple
---
kind: Service
apiVersion: v1
metadata:
labels:
elastic-app: elasticsearch-simple
name: elasticsearch-simple
namespace: ns-elastic
spec:
ports:
- port: 9300
targetPort: 9300
selector:
elastic-app: elasticsearch-simple
---
kind: Service
apiVersion: v1
metadata:
labels:
elastic-app: elasticsearch-simple-nodeport
name: elasticsearch-simple-nodeport
namespace: ns-elastic
spec:
ports:
- port: 9200
targetPort: 9200
selector:
elastic-app: elasticsearch-simple
type: NodePort
주: imagePullSecret,namespace,pv 등 대상
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
vagrant + CoreOS에서 kubernetes guestbook 샘플 이동제목대로 kubernetes의 guestbook 샘플을 먼저 움직이는 것이 목적입니다. kubernetes의 문서대로 움직였기 때문에 정리했습니다. Gentoo (linux-4.7.0-rc7) curl git vag...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.