本文共 1832 字,大约阅读时间需要 6 分钟。
在选择需要的版本下载:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
在想要安装的路径下进行解压,命令如下:
tar zxvf elasticsearch-6.4.2.tar.gz
jvm参数在elasticsearch安装目录中config目录下的“jvm.options”文件中,其中jvm堆大小的默认配置如下:
# Xms represents the initial size of total heap space# Xmx represents the maximum size of total heap space-Xms1g-Xmx1g
我们可以根据自己的需求来设置堆大小。其它的jvm参数可以自行查看jvm.options文件,且根据业务情况觉得是否修改,已经如何修改。
elasticsearch的基本配置在elasticsearch安装目录的config目录下的“elasticsearch.yml”中,其中包含了es的集群、节点、数据存储路径、日志路径、网络以及其他的一些自定义配置。如果只是安装单节点的es,那么就不需要去关心集群相关的配置。起初修改最基本的配置即可,后续可根据情况加入其他配置。基本配置设置情况如下:
# Path to directory where to store the data (separate multiple locations by comma):# 设置数据存储路径(多个路径用逗号隔开)#path.data: data0,data1path.data: /data/elasticsearch/data# Path to log files:# 设置日志的存储路径path.logs: /data/elasticsearch/logs# Set the bind address to a specific IP (IPv4 or IPv6):# 设置es监听网络,可根据自己的情况设定# 此处因用的是阿里云,所以需要用公网监听network.host: 0.0.0.0# Set a custom port for HTTP:# http网络端口,默认9200http.port: 9200# tcp端口默认9300
如此一个单节点的elasticsearch就可以启动使用了。
启动命令如下(若启动过程中有报错信息可以点击参考文章 ):
//直接启动//log输出在控制台./elasticsearch //后台运行//启动log在配置的logs路径中的elasticsearch.log中,log文件名为es集群名,默认情况下时elasticsearch./elasticsearch -d
启动成功验证:
浏览器访问http:ip:9200/或者直接在命令行输入如下命令:curl http://127.0.0.1:9200/
可以看到如下信息:
{ "name" : "KijSHar", "cluster_name" : "elasticsearch", "cluster_uuid" : "LYlfG_vZSP2ibQWIFH3BiQ", "version" : { "number" : "6.4.2", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "04711c2", "build_date" : "2018-09-26T13:34:09.098244Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search"}
转载地址:http://kbpin.baihongyu.com/