当前位置: 首页 > news >正文

docker compose部署opensearch集群

docker compose 配置

假设有两台电脑
A电脑的ip为192.168.1.100
B电脑的ip为192.168.1.103
A电脑的docker compose 配置

version: '3'services:opensearch:image: opensearchproject/opensearch:2.1.0container_name: opensearch-node-1environment:- cluster.name=opensearch-cluster- node.name=opensearch-node-1- network.publish_host=192.168.1.100- discovery.seed_hosts=192.168.1.100,192.168.1.103- cluster.initial_cluster_manager_nodes=192.168.1.100,192.168.1.103- bootstrap.memory_lock=true- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"- DISABLE_INSTALL_DEMO_CONFIG=true- DISABLE_SECURITY_PLUGIN=trueulimits:memlock:soft: -1hard: -1nofile:soft: 65536hard: 65536ports:- "9200:9200"- "9300:9300"volumes:- opensearch-data:/usr/share/opensearch/data- opensearch-config:/usr/share/opensearch/configvolumes:opensearch-data:opensearch-config:

B电脑的docker compose 配置

version: '3'services:opensearch:image: opensearchproject/opensearch:2.1.0container_name: opensearch-node-3environment:- cluster.name=opensearch-cluster- node.name=opensearch-node-3- network.publish_host=192.168.1.103- discovery.seed_hosts=192.168.1.100,192.168.1.103- cluster.initial_cluster_manager_nodes=192.168.1.100,192.168.1.103- bootstrap.memory_lock=true- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"- DISABLE_INSTALL_DEMO_CONFIG=true- DISABLE_SECURITY_PLUGIN=trueulimits:memlock:soft: -1hard: -1nofile:soft: 65536hard: 65536ports:- "9200:9200"- "9300:9300"volumes:- opensearch-data:/usr/share/opensearch/data- opensearch-config:/usr/share/opensearch/configvolumes:opensearch-data:opensearch-config:

设置内存

临时

sysctl -w vm.max_map_count=262144

永久

Disable memory paging and swapping performance on the host to improve performance.
禁用主机上的内存分页和交换性能以提高性能。
ps:这个看情况,内存大的话,也可以关掉

sudo swapoff -a

Increase the number of memory maps available to OpenSearch.
增加OpenSearch可用的内存映射数量。

# Edit the sysctl config file
sudo vi /etc/sysctl.conf# Add a line to define the desired value
# or change the value if the key exists,
# and then save your changes.
vm.max_map_count=262144# Reload the kernel parameters using sysctl
sudo sysctl -p# Verify that the change was applied by checking the value
cat /proc/sys/vm/max_map_count

两边同时启动

docker compose up -d

nginx设置集群

    server {listen       9200;location / {proxy_pass http://opensearch/;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header X-Forwarded-Port $server_port;proxy_set_header X-Forwarded-Host $http_host;}}upstream opensearch {server 192.168.1.100:9200;server 192.168.1.103:9200;}

参考

https://www.cnblogs.com/lz0925/p/12011026.html
https://opensearch.org/docs/latest/install-and-configure/install-opensearch/docker/

http://www.lryc.cn/news/320270.html

相关文章:

  • 粤嵌6818开发板通过MobaXterm使用SSH连接开发板
  • Python实战:Flask轻量级web框架入门
  • docker 安装minio,详细图解
  • 【SpringBoot】请求与响应参数 IoC与DI 总结
  • 100道面试必会算法-05-字符串转换整数 (atoi)
  • Ypay源支付2.8.8免授权聚合免签系统
  • 从零到一构建短链接系统(三)
  • C语言易错知识点:scanf函数
  • 如何实现图片上传至服务器
  • OSPF协议全面学习笔记
  • acwing算法提高之搜索--剪枝
  • 鸿蒙Harmony应用开发—ArkTS声明式开发(基础手势:Web)上篇
  • TPU浅谈
  • 华为OD机试 - 求字符串中所有整数的最小和(Java JS Python C C++)
  • goland设置保存文件时不将4个空格转为TAB
  • 基于Linux内核的socket编程(TCP)的C语言示例
  • 【WEEK3】 【DAY4】JSON交互处理第三部分【中文版】
  • 下载chromedrive,使用自动化
  • D-Star 寻路算法
  • mysql5.7编译安装
  • Java项目实战记录:雷达数据渲染
  • 进程的概念 | PCB | Linux下的task_struct | 父子进程和子进程
  • 【GPT-SOVITS-03】SOVITS 模块-生成模型解析
  • 2024HVV行动-进军蓝中研判(log4j2、fastjson、Struts2、Shiro)
  • 亮点抢先看!4月16-17日,百度Create大会开设“AI公开课”,大咖带你打造赚钱工具
  • 【笔记本清灰/实用经验】荣耀Magicbook14-2020款-R5-4500U-清灰实战
  • 如何写好Stable Diffusion的prompt
  • 计算机毕业设计 | SpringBoot+vue 移动端社区物业管理系统(附源码+论文)
  • 玩转C语言——数组初探
  • Nginx指令配置大全