PART Ⅰ : 容器云OPENSHIFT
- 安装
- 数据持久化
- 集群管理
- 数据持久化
- 管理
- 网络
- 安全审计
- 工具应用部署
PART Ⅱ:容器云 KUBERNETES
- 基础
- 原理
- 系统应用/网络CNI/TRaefik
- 安装
- 集群管理
- 用户认证ServiceAccount与授权策略RBAC
- K8S应用管理工具Helm
- 问题
- 辅助工具
- Doing:K8S 多集群管理与网络互联
- VM On K8S
PART Ⅲ:持续集成与持续部署
- CICD优化总结
- Jenkins
- Gitlab
- Drone
- Nexus
- 配置
- 使用OrientDB Console在DB层面修改配置
- [设置SMTP邮件服务](https://www.wenjiangs.com/doc/krrcu7ebin9hh
- 仓库管理
- 数据备份恢复
- API
- Jenkins相关插件
- 配置
- SonarQube静态代码扫描分析
- LDAP
- Apollo
- 项目管理工具
- Jira
- Redmine
- Harbor
- Vault
- Alfred
- Web IDE: VSCode
- DolphinScheduler
PART Ⅴ:日志/监控/告警
- Logging
- Kafka/Zookeeper
- Filebeat
- Metrics
- Tracing
- Sentry日志聚合告警平台
PART Ⅵ:基础
- Docker
- Shell脚本
- Mave
- git
- 正则表达式
- SSL/TLS
- Ceph
- 性能压力测试
- PXE+Kickstart
- netboot.xyz
- Tool
- Windows
- MacOS小技巧
- Linux
- Linux排错优化
- iptables详解
- MySQL
- Redis
- 负载均衡与代理
- 代理服务器
- Nginx
- GitBook
- Telegram机器人
- OpenVPN Server
- iDRAC
- vSphere
- Raspberry Pi树莓派
- 钉钉机器人
- Aliyun CLI
- 音、视频处理工具:fffmpeg
- 图片处理工具:Imagemagick
- PDF处理工具:Ghostscript
- Nvidia
- Virtualbox 虚拟机管理
- 阿里云产品使用总结
- RustDesk:可自建远程控制软件
- Poste:自建邮件服务器
- 使用 Jlink构建最小化依赖的 JRE 环境
- Aria2
- Asuswrt-Merlin
- Trap:Shell脚本信号跟踪
- 零散知识汇总
- BarkServer通知
- Synology
PART Ⅶ:数据存储、处理
PART VIII:CODE
- Python学习笔记
- 基础语法
- statik 将静态资源文件打包到二进制文件中
- HTML/CSS 学习笔记
- JavaScript学习笔记
PART X:HACKINTOSH
PART XI:安全
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Elasticsearch 容器化部署
docker pull docker.io/elasticsearch/elasticsearch:6.6.1
#或者
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.6.1
修改系统
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
sysctl -w vm.max_map_count=262144
Docker单节点部署
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.io/elasticsearch/elasticsearch:6.6.1
Docker compose集群部署
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
container_name: elasticsearch2
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=elasticsearch"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata2:/usr/share/elasticsearch/data
networks:
- esnet
volumes:
esdata1:
driver: local
esdata2:
driver: local
networks:
esnet:
DeploymentConfig
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app: elasticsearch
name: elasticsearch
spec:
replicas: 1
selector:
app: elasticsearch
deploymentconfig: elasticsearch
strategy:
type: Recreate
template:
metadata:
labels:
app: elasticsearch
deploymentconfig: elasticsearch
spec:
containers:
- env:
- name: discovery.type
value: single-node
- name: cluster.name
value: curiouser
- name: bootstrap.memory_lock
value: 'true'
- name: path.repo
value: /usr/share/elasticsearch/snapshots-repository
- name: TZ
value: Asia/Shanghai
- name: ES_JAVA_OPTS
value: '-Xms1g -Xmx2g'
- name: xpack.monitoring.collection.enabled
value: 'true'
- name: xpack.security.enabled
value: 'true'
- name: ELASTIC_USERNAME
value: "elastic"
- name: "ELASTIC_PASSWORD"
value: "elastic"
image: 'docker.elastic.co/elasticsearch/elasticsearch:7.1.1'
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 90
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 9200
timeoutSeconds: 1
name: elasticsearch
ports:
- containerPort: 9200
protocol: TCP
- containerPort: 9300
protocol: TCP
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 80
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 9200
timeoutSeconds: 1
resources:
limits:
cpu: '2'
memory: 3Gi
requests:
cpu: '1'
memory: 2Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
- mountPath: /usr/share/elasticsearch/snapshots-repository
name: elasticsearch-snapshots-repository
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: elasticsearch-data
persistentVolumeClaim:
claimName: elasticsearch-data
- name: elasticsearch-snapshots-repository
persistentVolumeClaim:
claimName: elasticsearch-snapshots-repository
test: false
triggers:
- type: ConfigChange
SVC
apiVersion: v1
kind: Service
metadata:
labels:
app: elasticsearch
name: elasticsearch
spec:
ports:
- name: 9200-tcp
port: 9200
protocol: TCP
targetPort: 9200
- name: 9300-tcp
port: 9300
protocol: TCP
targetPort: 9300
selector:
deploymentconfig: elasticsearch
sessionAffinity: None
type: ClusterIP
数据目录PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/storage-class: nfs-client-storageclass
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
snapshot repository存储目录PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/storage-class: nfs-client-storageclass
name: elasticsearch-snapshots-repository
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
Deployment
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
elastic-app: elasticsearch
role: master
name: elasticsearch-master
namespace: elk
spec:
replicas: 1
revisionHistoryLimit: 10
strategy:
type: Recreate
selector:
matchLabels:
elastic-app: elasticsearch
role: master
template:
metadata:
labels:
elastic-app: elasticsearch
role: master
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- node1.k8s.curiouser.com
initContainers:
- name: init-scheduler
image: busybox:latest
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'chmod -R 777 /usr/share/elasticsearch/data /usr/share/elasticsearch/snapshots-repository && chown -R 1000.0 /usr/share/elasticsearch/data /usr/share/elasticsearch/snapshots-repository']
volumeMounts:
- name: elasticsearch-data
mountPath: /usr/share/elasticsearch/data
- name: elasticsearch-snapshots-repository
mountPath: /usr/share/elasticsearch/snapshots-repository
containers:
- name: elasticsearch-master-data
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9200
protocol: TCP
- containerPort: 9300
protocol: TCP
env:
- name: "cluster.name"
value: "Curiouser"
- name: "bootstrap.memory_lock"
value: "false"
- name: discovery.type
value: single-node
- name: "node.master"
value: "true"
- name: "node.data"
value: "true"
- name: "node.ingest"
value: "false"
- name: xpack.monitoring.collection.enabled
value: "true"
- name: "xpack.monitoring.elasticsearch.collection.enabled"
value: "true"
- name: "xpack.security.enabled"
value: "true"
- name: "path.repo"
value: "/usr/share/elasticsearch/snapshots-repository"
- name: "ES_JAVA_OPTS"
value: "-Xms2048m -Xmx2048m"
- name: TZ
value: Asia/Shanghai
- name: "xpack.monitoring.exporters.my_local.type"
value: "local"
- name: "xpack.monitoring.exporters.my_local.use_ingest"
value: "false"
resources:
requests:
memory: "2Gi"
cpu: "2"
limits:
memory: "4096Mi"
cpu: "3"
readinessProbe:
failureThreshold: 1
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
tcpSocket:
port: 9200
timeoutSeconds: 1
livenessProbe:
failureThreshold: 1
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
tcpSocket:
port: 9200
timeoutSeconds: 1
volumeMounts:
- name: elasticsearch-data
mountPath: "/usr/share/elasticsearch/data"
- name: elasticsearch-snapshots-repository
mountPath: "/usr/share/elasticsearch/snapshots-repository"
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
volumes:
- name: elasticsearch-data
persistentVolumeClaim:
claimName: elasticsearch-data
- name: elasticsearch-snapshots-repository
persistentVolumeClaim:
claimName: elasticsearch-snapshots-repository
PersistentVolumeClaim
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/storage-class: cephfs
labels:
app: elasticsearch
name: elasticsearch-data
namespace: elk
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/storage-class: cephfs
labels:
app: elasticsearch
name: elasticsearch-snapshots-repository
namespace: elk
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 30Gi
Service
kind: Service
apiVersion: v1
metadata:
labels:
elastic-app: elasticsearch-service
name: elasticsearch
namespace: elk
spec:
ports:
- port: 9200
targetPort: 9200
protocol: TCP
selector:
elastic-app: elasticsearch
type: ClusterIP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论