运行环境如下
Centos 6.4
elasticsearch2.7.2
jdk-7u67-linux-x64.rpm
一、检查当前操作系统的版本
[root@es ~]# hostname //查看当前的主机名称 es [root@es ~]# uname -m //查看系统是多少位 x86_64 [root@es ~]# uname -r //查看内核版本 2.6.32-358.el6.x86_64 [root@es ~]# cat /etc/redhat-release //查看Centos 版本号 CentOS release 6.4 (Final) [root@es ~]#
二、安装JDK环境(jdk-7u67-linux-x64.rpm)
[root@es 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
立刻让环境变量配置文件生效
[root@es ~]# [root@es ~]# source /etc/profile //这两种生效方法 你用哪种都可以的 [root@es ~]# [root@es ~]# . /etc/profile [root@es ~]#
测试一下环境变量是否成功安装
[root@es ~]# 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安装完毕......
三、安装 elasticsearch2.7.2 软件
[root@es elasticsearch-1.7.2]# pwd /usr/local/elasticsearch-1.7.2 [root@es 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
[root@es bin]# pwd /usr/local/elasticsearch-1.7.2/bin [root@es 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 [root@es bin]# /bin/sh ./elasticsearch //启动了....
开始进入测试了....
克隆一个SecureCRT 会话选项来关闭防火墙设置
[root@es ~]# /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
并上传服务器上面去
[root@es src]# pwd /usr/local/src [root@es src]# unzip elasticsearch-servicewrapper-master.zip //解压软件 [root@es 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 [root@es src]# mv elasticsearch-servicewrapper-master/service/ /usr/local/elasticsearch-1.7.2/bin/ [root@es src]#
//将service目录移动到 elasticsearch下面的bin目录下面去 [root@es service]# pwd /usr/local/elasticsearch-1.7.2/bin/service [root@es 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.
开始安装服务
[root@es service]# ./elasticsearch install //开始安装 Detected RHEL or Fedora: Installing the Elasticsearch daemon..
[root@es service]# /etc/init.d/elasticsearch status //查看运行状态 Elasticsearch is not running. [root@es service]# chkconfig --list elasticsearch elasticsearch 0:off 1:off 2:on 3:on 4:on 5:on 6:off
========================
配置OK....恭喜你
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。