Elasticsearch 使用笔记(一)

1、下载程序包:
官方提供的下载说明
下载解压:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.tar.gz.sha512
shasum -a 512 -c elasticsearch-6.3.2.tar.gz.sha512 
tar -xzf elasticsearch-6.3.2.tar.gz
cd elasticsearch-6.3.2/ 

2、执行启动

./bin/elasticsearch

启动过程出现错误 can not run elasticsearch as root
这是官方建议不要用root用户启动程序,因为ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑, 要求我们创建一个单独的用户用来运行ElasticSearch。
新建用户组、用户:

groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
chown -R elsearch:elsearch  elasticsearch

切换用户执行

./bin/elasticsearch

启动过程出现错误 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改大小,最后一行添加vm.max_map_count=262144:

vi /etc/sysctl.conf 

启动过程出现错误max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

vi /etc/security/limits.conf

添加内容:

用户名 hard nofile 65536
用户名 soft nofile 65536

3、启动成功后,验证

curl -l http://192.168.43.118:9200/

返回一个 JSON 对象,包含当前节点、集群、版本等信息:

{
  "name" : "QUBkfjW",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "UXrLjxfnQjyo3KYsj8MpIQ",
  "version" : {
    "number" : "6.3.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "053779d",
    "build_date" : "2018-07-20T05:20:23.451332Z",
    "build_snapshot" : false,
    "lucene_version" : "7.3.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

如果其他机器访问不通的,解决方式:
在elasticsearch.yml添加

network.host: 0.0.0.0

还不行就关闭防火墙

你可能感兴趣的:(学习笔记,Elasticsearch,Elasticsearch,Elasticsearch安装)