新手安装elasticsearch

前提

a.JDK8+
b.系统可用内存>2G
我自己使用的是centos7.2

1、下载elasticsearch中文发行版

可以直接克隆

git clone https://github.com/medcl/elasticsearch-rtf.git

也可以百度云盘下载 https://pan.baidu.com/s/1pJNkrUV

2、安装

进入安装目录

[root@localhost elasticsearch]# ./bin/elasticsearch-plugin list  // 查看插件列表

[root@localhost elasticsearch]# bin/elasticsearch-plugin list> /tmp/plugin.log // 打印到log

删除多余插件

[root@localhost elasticsearch]# vim /tmp/plugin.log 
// 去除analysis-ik 很关键

[root@localhost elasticsearch]# cat /tmp/plugin.log|xargs -I {} bin/elasticsearch-plugin remove {}   

3、启动

[root@localhost elasticsearch]# ./bin/elasticsearch -d  
//这样会报错 ,root无法启动elasticsearch ,需要创建个新用户

[root@localhost elasticsearch]#  adduser  es
[root@localhost elasticsearch]#  passwd  es 
  ......
[root@localhost elasticsearch]#  chomd -R 777 /opt/elasticsearch
[root@localhost elasticsearch]# su es
[es@localhost elasticsearch]# ./bin/elasticsearch -d 

这样就没错了

[root@localhost elasticsearch]# curl 127.0.0.1:9200
{
  "name" : "v4cEn3-",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "dlWNa10MTai00Vx5fImHhw",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}

配置外网访问

[root@localhost elasticsearch]#  vim ./config/elasticsearch.yml

network.host: 0.0.0.0

也许会报错,如下解决办法

1、sudo vim /etc/sysctl.conf
加入:vm.max_map_count=262144 并执行命令:sysctl -p才生效
2、权限不够,导致/opt/elasticsearch/logs/elasticsearch.log日志文件以elasticsearch的文件没权限写入
解决:sudo chown -R es /opt/elasticsearch
3、ERROR: [4] bootstrap checks failed
[1]: initial heap size [264241152] not equal to maximum heap size [4215275520]; this can cause resize pauses and prevents mlockall from locking the entire heap
[2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[3]: max number of threads [1024] for user [kedacom] is too low, increase to at least [4096]
[4]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf 
修改如下内容:
* soft nproc 1024 #修改为* soft nproc 4096
切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf 
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 最近项目用到了es搜索引擎,行业对全文搜索引擎方面对es具有高度的评价,es基于目前最流行的开源Luence封装的...
    阿太哥阅读 4,933评论 0 0
  • 作者:罗海鹏,叩丁狼教育高级讲师。原创文章,转载请注明出处。 安装使用 elasticsearch是支持Li...
    叩丁狼教育阅读 9,417评论 0 3
  • 前几日闺蜜让我帮她买几本投资理财的书,刚一答应,就用微信转账过来了,并急切的催我收钱。我说:“急什么,等买到了再付...
    蓝烟777阅读 3,785评论 1 2
  • 今天上课在讲好好说话, 今天回家就又上了一课。 回家后看到少年离家时, 床上没有整理, 厨房没有整理。 心里有数,...
    千吉change阅读 1,176评论 0 0
  • 顺其自然是一个挺有意思的词语,用来安慰自己,也安慰身边的人。让我们在无法达成目标时有一个放手的理由,也让我们觉得一...
    拾无阅读 4,196评论 0 1