乐趣区

关于helm:通过-Helm-Chart-部署-Easysearch

Easysearch 能够通过 Helm 疾速部署了,快来看看吧!

Easysearch 的 Chart 仓库地址在这里 https://helm.infinilabs.com。

应用 Helm 部署 Easysearch 有两个前提条件:

  • cert-manager
  • local-path

咱们先依照 Chart 仓库的阐明来疾速部署一下。

~ helm repo add infinilabs https://helm.infinilabs.com
~ cat << EOF | kubectl apply -n test -f -
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: easysearch-ca-issuer
spec:
  selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: easysearch-ca-certificate
spec:
  commonName: easysearch-ca-certificate
  duration: 87600h0m0s
  isCA: true
  issuerRef:
    kind: Issuer
    name: easysearch-ca-issuer
  privateKey:
    algorithm: ECDSA
    size: 256
  renewBefore: 2160h0m0s
  secretName: easysearch-ca-secret
EOF
~ helm install easysearch infinilabs/easysearch -n test

执行下面的两个命令之后,查看一下部署状况

~ kubectl get pod -n test
NAME           READY   STATUS    RESTARTS   AGE
easysearch-0   1/1     Running   0          38s
~ kubectl get svc -n test
NAME                      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
easysearch-svc-headless   ClusterIP   None         <none>        9200/TCP,9300/TCP   67s
~ kubectl exec -n test easysearch-0 -it -- curl -ku'admin:admin' https://localhost:9200
Defaulted container "easysearch" out of: easysearch, init-config (init)
{
  "name" : "easysearch-0",
  "cluster_name" : "infinilabs",
  "cluster_uuid" : "JwhwwWHMQKy8l6_US7rB1A",
  "version" : {
    "distribution" : "easysearch",
    "number" : "1.5.0",
    "distributor" : "INFINI Labs",
    "build_hash" : "5b5b117bc43e6793e7bb0cd8bd83567a5ef35be0",
    "build_date" : "2023-09-07T14:55:21.232870Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.2",
    "minimum_wire_lucene_version" : "7.7.0",
    "minimum_lucene_index_compatibility_version" : "7.7.0"
  },
  "tagline" : "You Know, For Easy Search!"
}

通过下面的验证,咱们能够看到 Easysearch 曾经部署实现,是不是很不便。

依照 Chart 仓库的领导阐明部署的是一个单节点集群,那如果要部署多节点的要怎么办呢?上面让咱们来钻研一下 Easysearch Chart 包的源码 https://github.com/infinilabs/helm-charts/tree/main/charts/easysearch。

相熟 Chart 包构造的小伙伴都分明,Chart 包的变量配置个别都是在 values.yaml 文件中配置的。

咱们先来看一下默认的 values.yaml 文件内容(这里只截选了一些可能须要变更的配置,残缺内容请查阅源码):

  • pod 正本数以及应用资源的配置
replicaCount: 1
resources:
  limits:
    cpu: 1000m
    memory: 2Gi
  requests:
    cpu: 1000m
    memory: 2Gi
  • 应用存储类型以及容量的配置
storageClassName: local-path
dataVolumeStorage: 100Gi
  • 集群名、主节点列表以及节点角色配置
clusterName: infinilabs
masterHosts: '"easysearch-0"'
discoverySeedHosts: '"easysearch-0.easysearch-svc-headless"'
nodeRoles: '"master","data","ingest","remote_cluster_client"'

依据钻研源码的后果,多节点集群的部署只须要咱们调整部署的 pod 正本数、集群名、主节点列表以及节点角色这几个配置。上面让咱们来实际一下:

1、集群布局

集群名:es-test

规模:3 主节点 + 3 数据节点 + 2 协调节点

2、Chart 的版本名

主节点:es-test-master

数据节点:es-test-data

协调节点:es-test-coordinate

3、依据节点角色创立不同的 values.yaml 文件

  • es-test-master.yaml
replicaCount: 3
clusterName: es-test
masterHosts: '"es-test-master-easysearch-0","es-test-master-easysearch-1","es-test-master-easysearch-2"'
discoverySeedHosts: '"es-test-master-easysearch-0.es-test-master-easysearch-svc-headless","es-test-master-easysearch-1.es-test-master-easysearch-svc-headless","es-test-master-easysearch-2.es-test-master-easysearch-svc-headless"'
nodeRoles: '"master","ingest","remote_cluster_client"'
  • es-test-data.yaml
replicaCount: 3
clusterName: es-test
masterHosts: '"es-test-master-easysearch-0","es-test-master-easysearch-1","es-test-master-easysearch-2"'
discoverySeedHosts: '"es-test-master-easysearch-0.es-test-master-easysearch-svc-headless","es-test-master-easysearch-1.es-test-master-easysearch-svc-headless","es-test-master-easysearch-2.es-test-master-easysearch-svc-headless"'
nodeRoles: '"data","ingest","remote_cluster_client"'
  • es-test-coordinate.yaml
replicaCount: 2
clusterName: es-test
masterHosts: '"es-test-master-easysearch-0","es-test-master-easysearch-1","es-test-master-easysearch-2"'
discoverySeedHosts: '"es-test-master-easysearch-0.es-test-master-easysearch-svc-headless","es-test-master-easysearch-1.es-test-master-easysearch-svc-headless","es-test-master-easysearch-2.es-test-master-easysearch-svc-headless"'
nodeRoles: ""

4、应用各节点角色的配置文件部署

~ helm install es-test-master infinilabs/easysearch -n test -f es-test-master.yaml
~ helm install es-test-data infinilabs/easysearch -n test -f es-test-data.yaml
~ helm install es-test-coordinate infinilabs/easysearch -n test -f es-test-coordinate.yaml

5、验证

~ kubectl get pod -n test|grep es-test
es-test-master-easysearch-0       1/1     Running   0          5m57s
es-test-data-easysearch-0         1/1     Running   0          5m29s
es-test-coordinate-easysearch-0   1/1     Running   0          5m10s
es-test-master-easysearch-1       1/1     Running   0          4m57s
es-test-data-easysearch-1         1/1     Running   0          4m29s
es-test-coordinate-easysearch-1   1/1     Running   0          4m10s
es-test-master-easysearch-2       1/1     Running   0          3m56s
es-test-data-easysearch-2         1/1     Running   0          3m29s
~ kubectl exec -n test es-test-master-easysearch-0 -it -- curl -ku'admin:admin' https://localhost:9200/_cat/nodes?v
Defaulted container "easysearch" out of: easysearch, init-config (init)
ip          heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10.42.0.130           12          63  12    1.53    2.67     2.11 -         -      es-test-coordinate-easysearch-0
10.42.0.136           53          65  52    1.53    2.67     2.11 dir       -      es-test-data-easysearch-1
10.42.0.139            6          63  14    1.53    2.67     2.11 -         -      es-test-coordinate-easysearch-1
10.42.0.133           10          63  14    1.53    2.67     2.11 imr       -      es-test-master-easysearch-1
10.42.0.149           58          65  59    1.53    2.67     2.11 dir       -      es-test-data-easysearch-2
10.42.0.124           53          68  35    1.53    2.67     2.11 imr       *      es-test-master-easysearch-0
10.42.0.127           56          65  46    1.53    2.67     2.11 dir       -      es-test-data-easysearch-0
10.42.0.146           15          63  18    1.53    2.67     2.11 imr       -      es-test-master-easysearch-2

至此,多集群已部署实现。

对于 Easysearch

INFINI Easysearch 是一个分布式的近实时搜寻与剖析引擎,外围引擎基于开源的 Apache Lucene。Easysearch 的指标是提供一个轻量级的 Elasticsearch 可代替版本,并持续欠缺和反对更多的企业级性能。与 Elasticsearch 相比,Easysearch 更关注在搜寻业务场景的优化和持续放弃其产品的简洁与易用性。

官网文档:https://www.infinilabs.com/docs/latest/easysearch

下载地址:https://www.infinilabs.com/download

退出移动版