一 启动集群
master集群启动后进程查看
[root@master ~]# jps
7010 Jps
2777 ServerStartup
2686 QuorumPeerMain
slave1集群启动后进程查看
[root@slave1 ~]# jps
2585 QuorumPeerMain
5964 Jps
slave2集群启动后进程查看
[root@slave2 ~]# jps
5937 Jps
2551 QuorumPeerMain
二 MySQL建表
[root@master ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database blogchong;
Query OK, 1 row affected (0.00 sec)
mysql> use blogchong;
Database changed
mysql> CREATE TABLE `storm` (
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `domain` varchar(255) DEFAULT NULL,
-> `value` varchar(255) DEFAULT NULL,
-> `time` varchar(255) DEFAULT NULL,
-> `validity` varchar(255) DEFAULT NULL,
-> `seller` varchar(255) DEFAULT NULL,
-> PRIMARY KEY (`id`)
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> desc storm;
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| domain | varchar(255) | YES | | NULL | |
| value | varchar(255) | YES | | NULL | |
| time | varchar(255) | YES | | NULL | |
| validity | varchar(255) | YES | | NULL | |
| seller | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
三 生产数据模拟
运行DataProDucer或运行GetSource类的实例,生产数据。
四 本地模式执行
1、打印到屏幕落地方式
Tuple: www.mite8.com 1401 2010 20 Acong
log4j:WARN No appenders could be found for logger (com.taobao.gecko.service.impl.BaseRemotingController).
log4j:WARN Please initialize the log4j system properly.
MysqlBolt-- test connect mysql success: MysqlBolt.xml
MysqlBolt-- Conf Loaded: MysqlBolt.xml
Tuple: www.blogchong.cn 2000 2012 5 Blogchong
Tuple: www.google.com2000 2012 23 Blogchong
Tuple: www.baidu.net 240 2015 5 Pony
Tuple: www.cooje.cn 2000 2000 200 Blogchong
Tuple: www.baidu.cn 1401 2007 23 Blogchong
Tuple: www.cooje.net 1202 2002 50 Pony
Tuple: www.blogchong.cn 240 2011 20 Pony
Tuple: www.cooje.com 122 2015 100 Pony
2、打印到数据库落地方式
mysql> select * from storm;
+----+---------------------+-------+------+----------+-----------+
| id | domain | value | time | validity | seller |
+----+---------------------+-------+------+----------+-----------+
| 1 | www.mite8.com | 1401 | 2010 | 20 | Acong |
| 2 | www.blogchong.cn | 2000 | 2012 | 5 | Blogchong |
| 3 | www.google.com | 2000 | 2012 | 23 | Blogchong |
| 4 | www.baidu.net | 240 | 2015 | 5 | Pony |
| 5 | www.cooje.cn | 2000 | 2000 | 200 | Blogchong |
| 6 | www.baidu.cn | 1401 | 2007 | 23 | Blogchong |
| 7 | www.cooje.net | 1202 | 2002 | 50 | Pony |
| 8 | www.blogchong.cn | 240 | 2011 | 20 | Pony |
| 9 | www.cooje.com | 122 | 2015 | 100 | Pony |
| 10 | www.google.net | 1446 | 2011 | 12 | Blogchong |
| 11 | www.hitwh.com | 1326 | 2015 | 20 | Blogchong |
| 12 | www.jikexueyuan.com | 400 | 2000 | 12 | Blogchong |
| 13 | www.jikexueyuan.org | 240 | 2014 | 20 | Blogchong |
| 14 | www.google.com | 1326 | 2010 | 200 | Blogchong |
| 15 | www.hadoop.cn | 2000 | 2005 | 1 | Litao |
| 16 | www.blogchong.cn | 1401 | 1998 | 50 | Blogchong |
| 17 | www.google.net | 1401 | 1998 | 32 | Blogchong |
| 18 | www.mite8.com | 1871 | 2011 | 12 | Litao |
| 19 | www.blogchong.org | 122 | 2012 | 100 | Pony |
| 20 | www.mygod.org | 1401 | 1998 | 5 | Litao |
| 21 | www.google.org | 1871 | 2005 | 45 | Blogchong |
| 22 | www.mite8.com | 1401 | 2012 | 1 | Pony |
| 23 | www.baidu.org | 1401 | 2010 | 100 | Acong |
| 24 | www.hitwh.org | 122 | 2000 | 12 | Litao |
| 25 | www.hitwh.cn | 1871 | 2012 | 50 | Pony |
| 26 | www.hitwh.net | 400 | 2001 | 3 | Blogchong |
| 27 | www.google.com | 1202 | 2014 | 45 | Blogchong |
+----+---------------------+-------+------+----------+-----------+
27 rows in set (0.00 sec)
五 项目实例总结
六 参考