install-elasticsearch
安装与配置
导入密钥
1
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
配置源
在/etc/yum.repos.d/
目录下新建elasticsearch.repo
写入一下内容。1
2
3
4
5
6[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1安装
1
2
3yum clean all
# 需要jre支持
yum install java-1.8.0-openjdk.x86_64 elasticsearch -y配置开机启动
1
chkconfig --add elasticsearch
启动服务
1
service elasticsearch start
elasticsearch和传统数据库对照关系
在Elasticsearch中,文档归属于一种类型(type),而这些类型存在于索引(index)中,我们可以画一些简单的对比图来类比传统关系型数据库:
1 | Relational DB -> Databases -> Tables -> Rows -> Columns |
常见问题
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:
这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:1
2bootstrap.memory_lock: false
bootstrap.system_call_filter: falsemax file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
编辑limits.conf 文件追加
vim /etc/security/limits.conf1
2elasticsearch soft nofile 65536
elasticsearch hard nofile 65536max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
编辑90-nproc.conf 追加
vim /etc/security/limits.d/90-nproc.conf1
elasticsearch soft nproc 2048
报找不到JAVA_HOME
配置elasticsearch环境变量 ,增加
vim /etc/sysconfig/elasticsearch1
2
3# Elasticsearch Java path JAVA_HOME
# Elasticsearch Java path
JAVA_HOME=/usr/local/java/can not run elasticsearch as root
不能以root用户启动ES服务器。新建elasticsearch运行。
Could not register mbeans java.security.AccessControlException: access denied (“javax.management.MBeanTrustPermission” “register”)
找到使用的jre (find / -name java.policy) jre/lib/security/java.policy 追加
1
permission javax.management.MBeanTrustPermission "register";
Fielddata is disabled on text fields by default.
参考
- http://blog.csdn.net/feifantiyan/article/details/54614614
- http://blog.csdn.net/cardinalzbk/article/details/54924511
- https://yemengying.com/2016/03/18/Elasticsearch%E9%85%8D%E7%BD%AE%E9%A1%B9-Local-gateway-HTTP-Indices-Network-Settings%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE/
- http://es.xiaoleilu.com/010_Intro/25_Tutorial_Indexing.html