01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
|
use test;
create
table
wlslog
(id
int
not
null
,
time_stamp
varchar
(40),
category
varchar
(40),
type
varchar
(40),
servername
varchar
(40),
code
varchar
(40),
msg
varchar
(40),
primary
key
( id )
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(1,
'apr-8-2014-7:06:16-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000365'
,
'server state changed to standby'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(2,
'apr-8-2014-7:06:17-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000365'
,
'server state changed to starting'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(3,
'apr-8-2014-7:06:18-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000365'
,
'server state changed to admin'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(4,
'apr-8-2014-7:06:19-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000365'
,
'server state changed to resuming'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(5,
'apr-8-2014-7:06:20-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000361'
,
'started weblogic adminserver'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(6,
'apr-8-2014-7:06:21-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000365'
,
'server state changed to running'
);
insert
into
wlslog(id,time_stamp,category,type,servername,code,msg)
values
(7,
'apr-8-2014-7:06:22-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000360'
,
'server started in running mode'
);
commit
;
|
1
2
3
4
|
mkdir
-p
/var/lib/flume
cd
/var/lib/flume
touch
sql-
source
.status
chmod
-R 777
/var/lib/flume
|
1
2
|
hdfs dfs -
mkdir
-p
/flume/mysql
hdfs dfs -
chmod
-R 777
/flume/mysql
|
1
|
cp
flume-ng-sql-
source
-1.3.7.jar
/usr/hdp/current/flume-server/lib/
|
1
|
cp
mysql-connector-java-5.1.17.jar
/usr/hdp/current/flume-server/lib/mysql-connector-java
.jar
|
1
2
3
4
5
6
7
8
9
|
create
external
table
ext_wlslog
(id
int
,
time_stamp
varchar
(40),
category
varchar
(40),
type
varchar
(40),
servername
varchar
(40),
code
varchar
(40),
msg
varchar
(40)
) location (
'pxf://mycluster/flume/mysql?profile=hdfstextmulti'
) format
'csv'
(quote=e
'"'
);
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
agent.channels.ch1.
type
= memory
agent.sources.sql-
source
.channels = ch1
agent.channels = ch1
agent.sinks = HDFS
agent.sources = sql-
source
agent.sources.sql-
source
.
type
= org.keedio.flume.
source
.SQLSource
agent.sources.sql-
source
.connection.url = jdbc:mysql:
//172
.16.1.127:3306
/test
agent.sources.sql-
source
.user = root
agent.sources.sql-
source
.password = 123456
agent.sources.sql-
source
.table = wlslog
agent.sources.sql-
source
.columns.to.
select
= *
agent.sources.sql-
source
.incremental.column.name =
id
agent.sources.sql-
source
.incremental.value = 0
agent.sources.sql-
source
.run.query.delay=5000
agent.sources.sql-
source
.status.
file
.path =
/var/lib/flume
agent.sources.sql-
source
.status.
file
.name = sql-
source
.status
agent.sinks.HDFS.channel = ch1
agent.sinks.HDFS.
type
= hdfs
agent.sinks.HDFS.hdfs.path = hdfs:
//mycluster/flume/mysql
agent.sinks.HDFS.hdfs.fileType = DataStream
agent.sinks.HDFS.hdfs.writeFormat = Text
agent.sinks.HDFS.hdfs.rollSize = 268435456
agent.sinks.HDFS.hdfs.rollInterval = 0
agent.sinks.HDFS.hdfs.rollCount = 0
|
1
2
3
4
5
|
use
test
;
insert into wlslog(
id
,time_stamp,category,
type
,servername,code,msg) values(8,
'apr-8-2014-7:06:22-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000360'
,
'server started in running mode'
);
insert into wlslog(
id
,time_stamp,category,
type
,servername,code,msg) values(9,
'apr-8-2014-7:06:22-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000360'
,
'server started in running mode'
);
insert into wlslog(
id
,time_stamp,category,
type
,servername,code,msg) values(10,
'apr-8-2014-7:06:22-pm-pdt'
,
'notice'
,
'weblogicserver'
,
'adminserver'
,
'bea-000360'
,
'server started in running mode'
);
commit;
|