opensearch安装

简介

opensearch是一个社区驱动的数据存储和搜索引擎,基于es修改License之前的最后一个版本开发,安装流程其实和elasticsearch差不多

项目地址

https://opensearch.org/

操作

首先拉helm模版

helm pull opensearch/opensearch --version 2.4.0

helm pull opensearch/opensearch-dashboards --version 2.3.0

解压

tar -zxvf opensearch-dashboards-2.3.0.tgz

tar -zxvf opensearch-2.4.0.tgz

修改values.yaml

修改opensearch 相关参数

opensearch 这里我只修改storageClass

storageClass: "nfs-client"

要注意的是,如果你的vm.max_map_count小于262144会报错

你可以在kubelet中加上

allowed-unsafe-sysctls

相关参数,然后修改values.yaml开启

1
2
sysctl:
  enabled: false

具体的可以看

https://kubernetes.io/zh-cn/docs/tasks/administer-cluster/sysctl-cluster/

我这里为了方便只能手动修改节点中的vm.max_map_count

之后加个ingress

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
ingress:
  enabled: true
  # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
  # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
  # ingressClassName: nginx

  annotations:
    kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  path: /
  hosts:
    - opensearch.xxxxx.com
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

修改opensearch dashboard相关配置

dashboard这里就加个ingress就好了

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
ingress:
  enabled: true
  # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
  # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
  # ingressClassName: nginx
  annotations: 
    kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  hosts:
    - host: opensearch-dashboard.xxx.com
      paths:
        - path: /
          backend:
            serviceName: ""
            servicePort: ""
  tls: []

禁用安全插件

一般来说上面配置完成之后apply就好了,但是为了简单方便做开发可以禁用掉安全插件

详细的可以看下面

https://opensearch.org/docs/latest/security-plugin/configuration/disable/

首先配置opensearch

1
2
3
    plugins:
      security:
        disabled: true

之后配置dashboard

重新创建一个Dockerfile

1
2
3
FROM opensearchproject/opensearch-dashboards:2.2.0
RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin remove securityDashboards
COPY --chown=opensearch-dashboards:opensearch-dashboards opensearch_dashboards.yml /usr/share/opensearch-dashboards/config/

创建一个配置opensearch_dashboards.yml

1
2
3
4
5
server.port: 5601
server.host: "0.0.0.0"
server.name: "dashboards"
opensearch.hosts: ["http://opensearch-cluster-master:9200"]
logging.dest: stdout

之后build一个image在values.yaml中修改掉镜像名字就好了

最后

使用argocd去推送就好了,还有目前opensearch dashboard是不支持中文的

欢迎关注我的博客 www.bboy.app

Have Fun