OpenSearch 简介
•OpenSearch 是一款开源的分布式搜索引擎(从 ElasticSearch 特定版本分叉而来),可以执行快速、可扩展的全文搜索、应用程序和基础设施监控、安全和事件信息管理、运营健康跟踪等用例。
•OpenSearch 具有多种功能和插件,可以帮助索引、保护、监控和分析数据。
•OpenSearch 包含一个演示配置,以便您可以快速启动和运行,但在生产环境中使用 OpenSearch 之前,您必须使用自己的证书、身份验证方法、用户和密码手动配置安全插件。
•OpenSearch 由 AWS 支持,所有组件均可在 GitHub 上获得 Apache 许可证版本 2.0
拉取镜像
docker pull opensearchproject/opensearch:latest
docker pull opensearchproject/opensearch-dashboards:latest
启动一个单节点
docker run --name dev -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "network.host=0.0.0.0" -e "plugins.security.disabled=false" opensearchproject/opensearch:latest
参数说明:
discovery.type=single-node 单节点模式
network.host=0.0.0.0 在外部IP也能访问
plugins.security.disabled=true 禁用安全套件,就不用密码,此处启用密码
测试访问
curl https://localhost:9200 -ku 'admin:admin'
启动dashboard
docker run --name dev-dash -d -p 5601:5601 -e "server.host=0.0.0.0" -e 'OPENSEARCH_HOSTS=["https://192.168.100.100:9200"]' opensearchproject/opensearch-dashboards:latest
# 直接禁用安全套件,没有密码
docker run --name dev-dash -d -p 5601:5601 -e "server.host=0.0.0.0" -e 'OPENSEARCH_HOSTS=["http://192.168.100.101:9200"]' -e "DISABLE_SECURITY_DASHBOARDS_PLUGIN=true" opensearchproject/opensearch-dashboards:latest
使用方法和ES kibana差别不大。
docker-compose.yml参考
ersion: '3'
services:
opensearch-node1:
image: opensearchproject/opensearch:latest
container_name: opensearch-node1
environment:
- cluster.name=opensearch-cluster
- node.name=node-1
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_master_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
opensearch-node2:
image: opensearchproject/opensearch:latest
container_name: opensearch-node2
environment:
- cluster.name=opensearch-cluster
- node.name=node-2
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_master_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
dashboard:
image: opendistro-for-elasticsearch-kibana:${OPENDISTRO_VERSION}
container_name: odfe-dashboard
ports:
- "5601:5601"
expose:
- "5601"
environment:
ELASTICSEARCH_HOSTS: https://opensearch-node1:9200
ELASTICSEARCH_USERNAME: admin
ELASTICSEARCH_PASSWORD: admin
depends_on:
- opensearch-node1