## 十二 Python操作storm

- lein安装部署

  - 上传lein脚本

    ``` shell
    上传lein文件到centos
    chmod a+x lein
    mv lein /usr/bin/ #移动lein到/usr/bin目录下
    ```

  - 运行lein 会自动安装

  - 执行lein

    `lein`

  - 可能会报错

    ``` shell
    It's possible your HTTP client's certificate store does not have the
    correct certificate authority needed. This is often caused by an
    out-of-date version of libssl. It's also possible that you're behind a
    firewall and haven't set HTTP_PROXY and HTTPS_PROXY.
    ```

  - 解决办法 添加配置如下

    ``` shell
    export HTTP_CLIENT="wget --no-check-certificate -O"
    ```


```shell
再次执行lein
lein
即可下载安装成功
```

注：安装完成最好重新打开一个会话再进行streamparse安装

- streamparse安装

  ``` shell
  pip install streamparse
  ```

  - 下载wordcount案例

  ``` shell
  sparse quickstart wordcount
  ```

  - 进入wordcount目录

  ``` shell
  cd wordcount
  ```

  - 本地运行项目

  ``` shell
  sparse run
  ```

  - 此时需要等待一段时间，直到输出很多日志 从日志中可以看出统计的单词数据量结果

- 部署storm

  - 下载 &解压  这里使用storm-1.1.0版本

  ``` shell
  tar -zxvf apache_storm_1.1.0 -C ~/app/
  ```

  - 配置$STORM_HOME/conf/storm.yaml文件

    ``` shell
    storm.zookeeper.servers:
         - "localhost"
    
     storm.zookeeper.port: 2181
     ui.port: 9999
     storm.local.dir: "/root/bigdata/data/storm"
     supervisor.slots.ports:
         - 6700
         - 6701
         - 6702
         - 6703
    ```

    运行：

    zookeeper启动

    ​	dev-zookeeper 自带zk

    ​	storm dev-zookeeper 前台启动

    ​	nohup sh storm dev-zookeeper &

    ​	注：由于已经启动了外置的zookeeper，故：不执行上述指令

    nimbus 启动主节点

    ​	nohup sh storm nimbus &

    supervisor 启动从节点

    ​	nohup sh storm supervisor &

    ui 启动ui界面

    ​	nohup sh storm ui &

    logviewer 启动日志查看服务

    ​	nohup sh storm logviewer &




