搭建一個開源項目13-安裝IK分詞器和Zookeeper

1、安裝IK分詞器

  • 下載ik分詞器插件
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.2/elasticsearch-analysis-ik-
  • 使用linux下載會很慢,因而我本身去github上已經提早下載好了,下面開始安裝
[root@k8s-master ~]# mkdir /opt/elasticsearch/elasticsearch-6.4.2/plugins/elasticsearch-analysis-ik-6.4.2
[root@k8s-node-1 ~]# cd /opt/elasticsearch/elasticsearch-6.4.2/plugins/elasticsearch-analysis-ik-6.4.2
[root@k8s-node-1 elasticsearch-analysis-ik-6.4.2]# unzip elasticsearch-analysis-ik-6.4.2.tar.gz
  • 解壓即爲安裝好了IK分詞器,最後重啓elasticsearch集羣便可

2、ZOOKEEPER安裝部署

  • 將安裝包解壓縮apache-zookeeper-3.6.1-bin.tar.gz,並將其放在/root目錄下。
[root@k8s-master ~]# cd /usr/local
[root@k8s-master local]# mkdir zookeeper
[root@k8s-master local]# cd zookeeper/
[root@k8s-master zookeeper]# tar -zxvf /root/apache-zookeeper-3.6.1-bin.tar.gz -C ./
[root@k8s-master zookeeper]# cd apache-zookeeper-3.6.1-bin/
[root@k8s-master apache-zookeeper-3.6.1-bin]# mkdir data
  • 咱們須要將data目錄地址配置到ZooKeeper的配置文件中
[root@k8s-master apache-zookeeper-3.6.1-bin]# cd conf
[root@k8s-master conf]# cp zoo_sample.cfg zoo.cfg
[root@k8s-master conf]# vim zoo.cfg
  • 修改配置文件,將datadir修改成data目錄
    13.1
  • 啓動Zookeeper,並檢查狀態
[root@k8s-master apache-zookeeper-3.6.1-bin]# ./bin/zkServer.sh start
[root@k8s-master apache-zookeeper-3.6.1-bin]# ./bin/zkServer.sh status

13.2

  • 從上面能夠看出來綁定端口2181
  • 接下來配置環境變量以及設置開機啓動
[root@k8s-master ~]# vim /etc/profile
## 下面是在配置文中末尾加上這兩行
export ZOOKEEPER_HOME=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin
###
[root@k8s-master ~]# source /etc/profile
[root@k8s-master ~]# cd /etc/rc.d/init.d
[root@k8s-master init.d]# touch zookeeper
[root@k8s-master init.d]# chmod +x zookeeper 
[root@k8s-master init.d]# vim zookeeper
###添加下面的內容
#!/bin/bash
#chkconfig:- 20 90
#description:zookeeper
#processname:zookeeper
ZOOKEEPER_HOME=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin
export JAVA_HOME=/usr/local/java/jdk1.8.0_161
case $1 in
        start) su root $ZOOKEEPER_HOME/bin/zkServer.sh start;;
        stop) su root $ZOOKEEPER_HOME/bin/zkServer.sh stop;;
        status) su root $ZOOKEEPER_HOME/bin/zkServer.sh status;;
        restart) su root $ZOOKEEPER_HOME/bin/zkServer.sh restart;;
        *) echo "require start|stop|status|restart";;
esac
###
[root@k8s-master init.d]# chkconfig --add zookeeper
[root@k8s-master init.d]# chkconfig zookeeper on

3、源碼:

相關文章
相關標籤/搜索