之前虽做了solr-hbase构建二级索引以及快速查询,但是考虑到以后生成的数据可能会很多,一旦到了亿级以上,solr查询效率会渐渐慢下来.老板不满意,又听了几位专家的建议,采用Elasticsearch+hbase
来实现hbase中数据的快速查询.

首先,安装Elasticsearch.
CDH中没有集成Elasticsearch,所以只好独立安装.
1.下载elasticsearch-5.2.1.tar.gz

解压
tar zxvf /usr/local/elasticsearch/elasticsearch-5.2.1.tar.gz
vi /usr/local/elasticsearch/elasticsearch-5.2.1/config/elasticsearch.yml

c2节点:

找到node.name,改成:es-node1

找到network.host,去掉#,改为centos真实的ip, 10.0.0.12

discovery.zen.ping.unicast.hosts: [“10.0.0.12”, “10.0.0.13”,”10.0.0.14”]

c3节点:

找到node.name,改成:es-node2

找到network.host,去掉#,改为centos真实的ip, 10.0.0.13
discovery.zen.ping.unicast.hosts: [“10.0.0.12”, “10.0.0.13”,”10.0.0.14”]

c4节点:

找到node.name,改成:es-node3

找到network.host,去掉#,改为centos真实的ip, 10.0.0.14
discovery.zen.ping.unicast.hosts: [“10.0.0.12”, “10.0.0.13”,”10.0.0.14”]

新建用户组:
groupadd group_es useradd -g group_es es_user passwd es_user
给es_user 权限区域设为es目录:
chown -R es_user.group_es /usr/local/elasticsearch
启动:
su es_user cd /usr/local/elasticsearch/ nohup elasticsearch-5.2.1
/bin/elasticsearch & > nohup.out
停止:
ps -ef | grep elasticsearch kill -9 pid
自带命令启动|停止方式:
su - es_user -c
"/usr/local/elasticsearch/elasticsearch-5.2.1/bin/elasticsearch &"
由于这里是在已有的环境中安装ES,包括jdk版本等,会遇到一些错误.
错误解决:
Exception in thread “main” java.lang.UnsupportedClassVersionError:
org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 52.0

原因:jdk版本问题太低

解决方案1:更换jdk版本,ElasticSearch5.0.0支持jdk1.8.0以上

解决方案2:

安装jdk8,路径:/usr/local/jdk1.8.0_144

每台机器,在/etc/profile 中加入:
export ES_JAVA_HOME=/usr/local/jdk1.8.0_144 source /etc/profile vi
/usr/local/elasticsearch/elasticsearch-5.2.1/bin/elasticsearch


将上图JAVA_HOME 替换为ES_JAVA_HOME
重启es,就可以了.
如果依然报了 “Elasticsearch requires at least Java 8 but your Java version from
XXXX does not meet this requirement”

  上面的错误提示是在“elasticsearch.in.bat”这个文件下的。在那个文件下依然会有一个叫
%JAVA_HOME%的相关配置。把那个文件的JAVA_HOME 替换成我们新建的 ES_JAVA_HOME。
  然后保存,启动ES服务!
  
ERROR:
max file descriptors [4096] for elasticsearch process is too low, increase to
at least [65536]

原因:无法创建本地文件问题,用户最大可创建文件数太小

解决方案:

切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
备注:* 代表Linux所有用户名称(比如 hadoop)

保存、退出、重新登录才可生效

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

原因:最大虚拟内存太小

解决方案:切换到root用户下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后重新启动elasticsearch,即可启动成功。

ERROR修改配置中集群名字后启动失败

yml的配置文件中 冒号后边要跟有 一个空格,不要出现tab符,如下:

cluster.name: test

此外,ES还有一些插件安装,用来监控ES状态的.自ES5.x以后,插件都要独立安装了,具体可以找下百度和google.

这里有个bigdesk插件注意一下:
git clone https://github.com/hlstudio/bigdesk.git
安装:
cd /usr/local/elasticsearch/bigdesk/_site python -m SimpleHTTPServer
后台运行:
nohup python -m SimpleHTTPServer & > nohup.out
参考资料:
http://blog.csdn.net/it_lihongmin/article/details/78378137
<http://blog.csdn.net/it_lihongmin/article/details/78378137>
http://blog.csdn.net/u012246178/article/details/63253531
<http://blog.csdn.net/u012246178/article/details/63253531>
http://blog.csdn.net/liuchude123/article/details/77097124
<http://blog.csdn.net/liuchude123/article/details/77097124>
等.

友情链接
ioDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信