es7.4安裝


環境:

OS:Centos 7

ES:7.4.2

1.下載二進制安裝包
我這里下載的是:elasticsearch-7.4.2-linux-x86_64.tar.gz

2.解壓縮並創建數據目錄
[root@localhost soft]# tar -xvf elasticsearch-7.4.2-linux-x86_64.tar.gz
[root@localhost soft]# mv elasticsearch-7.4.2 /opt/
[root@localhost soft]#cd /opt/elasticsearch-7.4.2


3.創建用戶
因為啟動es不能在root用戶下啟動,所以要事先創建非root用戶
[root@localhost opt]# useradd esuser
[root@localhost opt]# chown -R esuser.esuser ./elasticsearch-7.4.2/


4.修改配置文件
[esuser@localhost config]$ more elasticsearch.yml
##集群名稱
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#節點名稱
node.name: node-1
# Path to directory where to store the data (separate multiple locations by comma):
#數據目錄
path.data: /opt/elasticsearch-7.4.2/data
#日志目錄
path.logs: /opt/elasticsearch-7.4.2/logs
#
# Set the bind address to a specific IP (IPv4 or IPv6):
## 設置綁定的ip,設置為本機的ip
network.host: 192.168.1.118
# Set a custom port for HTTP:
#端口
http.port: 9200

#設置在集群中的所有節點名稱,這個節點名稱就是之前所修改的,當然你也可以采用默認的也行,目前是單機,放入一個節點即可
#注意這里,如果目前是單節點的話,一定要修改該值為節點的名稱,否則雖然啟動成功了,但是通過curl命令向elasticsearch服務中新增數據時,會出現 "master_not_discovered_exception"錯誤
cluster.initial_master_nodes: ["node-1"]

xpack.security.transport.ssl.enabled: true
xpack.security.enabled: true


5.啟動
[esuser@localhost bin]$ ./elasticsearch -d
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

6.設置密碼

6.8之后的版本,x-pack已經免費,不需要單獨破解
[esuser@localhost bin]$ ./elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

7.驗證
[esuser@localhost bin]$ curl -u elastic:elastic http://192.168.1.118:9200/?pretty
{
  "name" : "node-1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "zbra9WCcRZGZ_DdsBDX7eg",
  "version" : {
    "number" : "7.4.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
    "build_date" : "2019-10-28T20:40:44.881551Z",
    "build_snapshot" : false,
    "lucene_version" : "8.2.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}


[esuser@localhost bin]$ curl -u elastic:elastic "192.168.1.118:9200/_license"
{
  "license" : {
    "status" : "active",
    "uid" : "d1db35c6-7537-4aba-b480-530e61b8099b",
    "type" : "basic",
    "issue_date" : "2019-12-17T06:13:25.909Z",
    "issue_date_in_millis" : 1576563205909,
    "max_nodes" : 1000,
    "issued_to" : "elasticsearch",
    "issuer" : "elasticsearch",
    "start_date_in_millis" : -1
  }
}

 

-- The End --


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM