大数据Druid对接Java套件安装

1.安装nodejs,版本需要在4.0以上

2.下载imply,地址:http://imply.io/download

3.imply安装步骤:

1.解压Imply
tar -xzf imply-2.0.0.tar 

2.启动服务
nohup bin/supervise -c conf/supervise/quickstart.conf > test.log &

3.数据导入
./bin/post-index-task --file quickstart/wikiticker-index.json

4.查询数据
curl -L -H'Content-Type: application/json' -XPOST --data-binary @quickstart/wikiticker-top-pages.json http://localhost:8082/druid/v2/

#服务停止与启动命令
./server --down 关闭  
./server --restart ${服务名称} 重启  

4.plyql安装步骤

1.安装plyql
npm install -g plyql

2.启动plyql
plyql -h 127.0.0.1:8082 -c 8 --experimental-mysql-gateway 3307

3.使用mysql客户端查询数据
plyql -h 127.0.0.1:8082 -q 'SHOW TABLES'

4.启动mysql客户端
mysql -h 127.0.0.1 -P 3307 --default-character-set=utf8

5.java通过plyql查询druid:

package com.druid.test;

import java.sql.*;
public class PlyqlTest {  
    public void plyql()  throws SQLException{

         Connection con = DriverManager.getConnection("jdbc:mysql://ip:3307/plyql1");
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(
              "SELECT count(*) AS cnt FROM wikiticker"
            );
            
            while (rs.next()) {
              long count = rs.getLong("cnt");
              System.out.println("count:"+count);
            }
    }
    
    public static void main(String...args)  throws SQLException{
        PlyqlTest p = new PlyqlTest();
        p.plyql();
    	}
    }

通过plyql,用jdbc查询druid时,遇到过一些问题,总结如下:

1.启动mysql客户端,连接上plyql后,无论使用什么命令,都报如下错误:

ERROR 1064 (_____): SQL parse error: undefined is not a function on ‘show tables’

错误原因:应该是nodejs的版本导致的,我升级nodejs到最新版本v8.2.0就解决了这个问题。

2.在java端连接到plyql时,报了一个很奇怪的错误,错误指向mysql的驱动包中,解决办法是替换mysql驱动包。

驱动包下载地址:

https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22mysql%22%20AND%20a%3A%22mysql-connector-java%22
Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤Imply详细安装步骤
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值