OpenSearch 安裝教學 | 最新-2.18 版快速安裝

瀏覽人次: 1430

現在就跟著小幫手一起來快速安裝 OpenSearch 吧!(以 Ubuntu 系統示範)


下載最新版本 OpenSearch 2.18 安裝包

安裝基本套件

$ sudo apt-get update && sudo apt-get -y install lsb-release ca-certificates curl gnupg2

導入 GPG 公鑰

$ curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring

創建 apt 儲存庫

$ echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-2.x.list

更新儲存庫

$ sudo apt-get update

列出 OpenSearch 可用版本

$ sudo apt list -a opensearch

選擇欲安裝版本,若無指定,將安裝當前最新版

### 2.12 後的版本需先設定 admin 的密碼
$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=${admin-password} apt-get install opensearch=2.18

### 如需 2.11 前的版本可直接指定版號後安裝
$ sudo apt-get install opensearch=${version}

OpenSearch 設定

修改 Opensearch 的 YML

$ sudo vi /etc/opensearch/opensearch.yml

### 不同的集群使用不同的 cluster.name
cluster.name: bimap

### 默認是主機名
node.name: ${HOSTNAME}

### 根據路徑修改 可以多個
### 如在data下需新建
path.data: /data/opensearch

bootstrap.memory_lock: true
network.host: ${IP}

### 根據需求,可以連接多台主機,此處以單機模式做演示:
discovery.type: single-node

調整 JVM 設定

$ sudo vi /etc/opensearch/jvm.options

### 建議設置為記憶體的一半,如:記憶體為 8G,則設置為 4G
-Xms4g
-Xmx4g

啟動 Opensearch

$ sudo systemctl start opensearch
$ sudo systemctl enable opensearch
$ sudo systemctl status opensearch

驗證是否成功啟動

$ sudo curl -X GET https://${IP}:9200 -u 'admin:${admin-password}' -k

{
"name" : "cluster-2",
"cluster_name" : "bimap",
"cluster_uuid" : "xo7zevQoQtmqguLUTb4O4Q",
"version" : {
"distribution" : "opensearch",
"number" : <version>,
"build_type" : <build-type>,
"build_hash" : <build-hash>,
"build_date" : <build-type>,
"build_snapshot" : false,
"lucene_version" : <lucene-version>,
"minimum_wire_compatibility_version" : "7.10.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}

OpenSearch Dashboards 設定

修改權限

$ sudo chown -R opensearch-dashboards. /etc/opensearch-dashboards

設定 opensearch_dashboards.yml 檔

$ sudo vi /etc/opensearch-dashboards/opensearch_dashboards.yml

opensearch.hosts: [https://localhost:9200]
opensearch.ssl.verificationMode: none
opensearch.username: ${username}
opensearch.password: ${password}

### 以下取消#
server.port: 5601
server.host: "0.0.0.0"

啟動 OpenSearch Dashbords

$ sudo systemctl start opensearch-dashboards.service
$ sudo systemctl enable opensearch-dashboards.service
$ sudo systemctl status opensearch-dashboards.service


有任何問題,或是想看新主題?

聯絡我們

快速跳轉目錄

✦ 集先鋒 Bimap – 企業建置高速穩定的海量日誌分析平台✦

集中不同的結構化資料和非結構化日誌,並進行關聯性的大數據整合,客製化儀表版、自訂事件告警、機器學習等等,以滿足各種大數據的應用場景和解決方案。