elasticsearch

Posted rocky-fang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch相关的知识,希望对你有一定的参考价值。

0.前提 jdk env

1.下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zip   

2. 解压

unzip elasticsearch-5.5.1.zip

3. 运行

cd /usr/local/mydev/elasticsearch-5.5.1

./bin/elasticsearch

3.1 报错如下

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

解决方法

groupadd test

useradd test -g test -p mypassword

chown -R test:test /usr/local/mydev/elasticsearch-5.5.1

su test #switch to user test, run again

 3.2 报错如下

  max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方法:

su -  #切换到root

vi  /etc/sysctl.conf

vm.max_map_count=655360# 添加该行

 sysctl -p#退出在执行

3.2 报错如下

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

vi /etc/security/limits.conf

#rocky dev is username , * equals all
 dev            soft    nofile          65536
 dev            hard    nofile          65536

#再切换回dev

4. 另起一个窗口

[[email protected]_pc1 ~]$ curl localhost:9200
{
  "name" : "426eH55",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "KX_7vn6iS06pHfhpKh1qDQ",
  "version" : {
    "number" : "5.5.1",
    "build_hash" : "19c13d0",
    "build_date" : "2017-07-18T20:44:24.823Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}

5. Index

5.1 查看当前节点的所有Index

[[email protected]_pc1 ~]$ curl -X GET ‘http://localhost:9200/_cat/indices?v‘
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size

5.2 新建名叫weather的Index 使用put方式

[[email protected]_pc1 ~]$ curl -X PUT  ‘localhost:9200/weather‘
{"acknowledged":true,"shards_acknowledged":true}

5.3 删除这个weather

[[email protected]_pc1 ~]$ curl -X DELETE ‘localhost:9200/weather‘
{"acknowledged":true}

 

以上是关于elasticsearch的主要内容,如果未能解决你的问题,请参考以下文章