運行環境如下
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。