zoukankan      html  css  js  c++  java
  • elasticsearch-head 安装

    一、安装phantomjs(由于入坑多写一步,此步骤可省掉)

    1.下载phantomjs

    安装npm的时候会依赖phantomjs 所以我们先安装phantomjs

    phantomjs 下载地址:http://phantomjs.org/download.html

    可以复制下载地址通过命令来下载,如下

    wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

    2.解压安装包

     ① yum install bzip2

     ② bzip2 -d phantomjs-2.1.1-linux-x86_64.tar.bz2

     ③ tar -xvf phantomjs-2.1.1-linux-x86_64.tar

    3.安装(由于我的解压目录在 /home/tools/phantomjs-2.1.1-linux-x86_64,所以后面就直接写绝对路径了)

    ① 将可执行文件放入系统路径

       ln -s /home/tools/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs

    ② 安装依赖——fontconfig和freetype

      yum install fontconfig freetype2

    ③ 配置环境变量

      vim /etc/profile

      export  PHANTOMJS=/home/tools/phantomjs-2.1.1-linux-x86_64

      export  PATH=$PATH:$PHANTOMJS/bin

      保存后执行:source /etc/profile

    ④ 测试 执行如下命令会显示phantomjs的版本

      phantomjs -v

    二、安装node

    1.检测node环境 (如果存在可以直接看第三步)

      node -v

    2.安装 node

      ① 下载nodejs 下载地址:https://nodejs.org/en/download/
        wget https://nodejs.org/dist/v8.11.2/node-v8.11.2-linux-x64.tar.xz 
      

      ② 解压 node
        xz -d node-v8.11.2-linux-x64.tar.xz
        tar -xvf node-v8.11.2-linux-x64.tar  
      

      ③ 建立软连接,变为全局
        ln -s /home/tools/node/node-v8.11.2-linux-x64/bin/node /usr/local/bin/node
        ln -s /home/tools/node/node-v8.11.2-linux-x64/bin/npm /usr/local/bin/npm

      ④ 安装 npm,grunt

        npm install -g cnpm

        npm install -g grunt-cli

      ⑤ 配置环境变量

        vim /etc/profile

        在文件最后添加

        export  NODE_HOME=/home/tools/node/node-v8.11.2-linux-x64

        export  PATH=$PATH:$NODE_HOME/bin

        保存后执行 source /etc/profile

      ⑥ 测试

        node -v

        npm -v

        grunt -version

     


    三、安装 elasticsearch-head

    elasticsearch-head 的开源地址:https://github.com/mobz/elasticsearch-head


    1.下载并解压

      wget https://github.com/mobz/elasticsearch-head/archive/master.zip
      unzip master.zip  //如果没有unzip这个命令 可以通过 yum install unzip 进行安装


    2.安装

      进入解压好的目录 cd elasticsearch-head-master 执行 npm install

      很多教程都这么讲的,此时我入坑了,会出现以下问题

    将  npm install 改为  npm install -g  即可

    测试:在elasticsearch-head-master 目录下启动 nodejs : grunt server

    通过浏览器访问:http://ip:9100 如下

    四、跨域问题处理

    1.问题说明

    上诉步骤执行完以后启动elasticsearch服务会发现 elasticsearch-head插件连接不上elasticsearch服务,此时可查看浏览器控制台有跨域的错误出现

    2.问题处理

    编辑 elasticsearch 服务 config/elasticsearch.yml

    在文件的最后加入

    http.cors.enabled: true
    http.cors.allow-origin: "*"

    保存文件,从启elasticsearch服务,再次连接,即可成功,如图

  • 相关阅读:
    关于jquery动态添加的新元素无法绑定事件那些事
    关于jquery获取json数据的格式问题
    beescms文章列表页函数学习
    beescms相关函数学习
    这是二零一四年十点整的广州
    POJ 1852 Ants 分析
    hiho_1114_扫雷
    hiho_1014_Trie_Tree
    排列组合
    用链表写的冒泡排序理解
  • 原文地址:https://www.cnblogs.com/gyli20170901/p/10151859.html
Copyright © 2011-2022 走看看