elasticsearch安装教程
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch安装教程相关的知识,希望对你有一定的参考价值。
运行环境如下
Centos 6.4
elasticsearch1.7.2
jdk-7u67-linux-x64.rpm
一、检查当前操作系统的版本
[[email protected] ~]# hostname //查看当前的主机名称 es [[email protected] ~]# uname -m //查看系统是多少位 x86_64 [[email protected] ~]# uname -r //查看内核版本 2.6.32-358.el6.x86_64 [[email protected] ~]# cat /etc/redhat-release //查看Centos 版本号 CentOS release 6.4 (Final) [[email protected] ~]#
二、安装JDK环境(jdk-7u67-linux-x64.rpm)
[[email protected] src]# rpm -ivh jdk-7u67-linux-x64.rpm Preparing... ########################################### [100%] 1:jdk ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... jfxrt.jar...
配置环境变量 vi /etc/profile 在这个文件的最后添加上配置
#set java environment JAVA_HOME=/usr/java/jdk1.7.0_67 CLASSPATH=.:$JAVA_HOME/lib.tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASSPATH PATH
立刻让环境变量配置文件生效
[[email protected] ~]# [[email protected] ~]# source /etc/profile //这两种生效方法 你用哪种都可以的 [[email protected] ~]# [[email protected] ~]# . /etc/profile [[email protected] ~]#
测试一下环境变量是否成功安装
[[email protected] ~]# java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
JDK安装完毕......
三、安装 elasticsearch1.7.2 软件
[[email protected] elasticsearch-1.7.2]# pwd /usr/local/elasticsearch-1.7.2 [[email protected] elasticsearch-1.7.2]# ll total 40 drwxr-xr-x. 2 root root 4096 Mar 17 22:49 bin drwxr-xr-x. 2 root root 4096 Mar 17 22:49 config drwxr-xr-x. 3 root root 4096 Mar 17 22:49 lib -rw-rw-r--. 1 root root 11358 Sep 14 2015 LICENSE.txt -rw-rw-r--. 1 root root 150 Sep 14 2015 NOTICE.txt -rw-rw-r--. 1 root root 8700 Sep 14 2015 README.textile
启动 elasticsearch
[[email protected] bin]# pwd /usr/local/elasticsearch-1.7.2/bin [[email protected] bin]# ll total 324 -rwxr-xr-x. 1 root root 8114 Sep 14 2015 elasticsearch -rw-rw-r--. 1 root root 901 Sep 14 2015 elasticsearch.bat -rw-rw-r--. 1 root root 2797 Sep 14 2015 elasticsearch.in.bat -rwxr-xr-x. 1 root root 2170 Sep 14 2015 elasticsearch.in.sh -rw-rw-r--. 1 root root 104448 Sep 14 2015 elasticsearch-service-mgr.exe -rw-rw-r--. 1 root root 103936 Sep 14 2015 elasticsearch-service-x64.exe -rw-rw-r--. 1 root root 80896 Sep 14 2015 elasticsearch-service-x86.exe -rwxr-xr-x. 1 root root 2523 Sep 14 2015 plugin -rw-rw-r--. 1 root root 482 Sep 14 2015 plugin.bat -rw-rw-r--. 1 root root 6210 Sep 14 2015 service.bat [[email protected] bin]# /bin/sh ./elasticsearch //启动了....
开始进入测试了....
克隆一个SecureCRT 会话选项来关闭防火墙设置
[[email protected] ~]# /etc/init.d/iptables stop iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ]
关闭之后 在浏览器上面输入地址: http://172.16.10.100:9200/
成功安装.....
四、我们要配置成开自启动服务
到这里把软件下载:https://github.com/elastic/elasticsearch-servicewrapper
并上传服务器上面去
[[email protected] src]# pwd /usr/local/src [[email protected] src]# unzip elasticsearch-servicewrapper-master.zip //解压软件 [[email protected] src]# ll total 153708 -rw-r--r--. 1 root root 28478292 Dec 29 10:47 elasticsearch-1.7.2.tar.gz drwxr-xr-x. 3 root root 4096 Feb 14 03:02 elasticsearch-servicewrapper-master -rw-r--r--. 1 root root 2054227 Mar 17 14:10 elasticsearch-servicewrapper-master.zip -rw-r--r--. 1 root root 126857158 Dec 21 17:09 jdk-7u67-linux-x64.rpm [[email protected] src]# mv elasticsearch-servicewrapper-master/service/ /usr/local/elasticsearch-1.7.2/bin/ [[email protected] src]#
//将service目录移动到 elasticsearch下面的bin目录下面去 [[email protected] service]# pwd /usr/local/elasticsearch-1.7.2/bin/service [[email protected] service]# ./elasticsearch Usage: ./elasticsearch [ console | start | stop.... ] Commands: console Launch in the current console. start Start in the background as a daemon process. stop Stop if running as a daemon or in another console. restart Stop if running and then start. condrestart Restart only if already running. status Query the current status. install Install to start automatically when system boots. remove Uninstall. dump Request a Java thread dump if running.
开始安装服务
[[email protected] service]# ./elasticsearch install //开始安装 Detected RHEL or Fedora: Installing the Elasticsearch daemon..
[[email protected] service]# /etc/init.d/elasticsearch status //查看运行状态 Elasticsearch is not running. [[email protected] service]# chkconfig --list elasticsearch elasticsearch 0:off 1:off 2:on 3:on 4:on 5:on 6:off
========================
配置OK....恭喜你
以上是关于elasticsearch安装教程的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearch入门教程:Elasticsearch及插件安装
ElasticSearch学习问题记录——Invalid shift value in prefixCoded bytes (is encoded value really an INT?)(代码片段