Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mock-data
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖鸣韬
mock-data
Commits
36cb1379
Commit
36cb1379
authored
Jun 29, 2020
by
廖鸣韬
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理项目
parent
4700aa2b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
273 additions
and
52 deletions
+273
-52
.idea/jarRepositories.xml
.idea/jarRepositories.xml
+5
-0
.idea/uiDesigner.xml
.idea/uiDesigner.xml
+124
-0
src/main/java/com/zorkdata/tools/kafka/CommonProducer.java
src/main/java/com/zorkdata/tools/kafka/CommonProducer.java
+28
-0
src/main/java/com/zorkdata/tools/kafka/Config.java
src/main/java/com/zorkdata/tools/kafka/Config.java
+37
-0
src/main/java/com/zorkdata/tools/kafka/Producer.java
src/main/java/com/zorkdata/tools/kafka/Producer.java
+12
-3
src/main/java/com/zorkdata/tools/mock/MockFilebeatDataToKafka.java
...java/com/zorkdata/tools/mock/MockFilebeatDataToKafka.java
+55
-42
src/main/java/com/zorkdata/tools/mock/MockGrok.java
src/main/java/com/zorkdata/tools/mock/MockGrok.java
+4
-0
src/main/java/com/zorkdata/tools/mock/MockStreamxLogAvro.java
...main/java/com/zorkdata/tools/mock/MockStreamxLogAvro.java
+2
-2
src/main/java/com/zorkdata/tools/utils/PropertiesUtil.java
src/main/java/com/zorkdata/tools/utils/PropertiesUtil.java
+6
-5
No files found.
.idea/jarRepositories.xml
View file @
36cb1379
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RemoteRepositoriesConfiguration"
>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Central Repository"
/>
<option
name=
"url"
value=
"https://repo.maven.apache.org/maven2"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Maven Central repository"
/>
...
...
.idea/uiDesigner.xml
0 → 100644
View file @
36cb1379
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Palette2"
>
<group
name=
"Swing"
>
<item
class=
"com.intellij.uiDesigner.HSpacer"
tooltip-text=
"Horizontal Spacer"
icon=
"/com/intellij/uiDesigner/icons/hspacer.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"1"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"com.intellij.uiDesigner.VSpacer"
tooltip-text=
"Vertical Spacer"
icon=
"/com/intellij/uiDesigner/icons/vspacer.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"1"
anchor=
"0"
fill=
"2"
/>
</item>
<item
class=
"javax.swing.JPanel"
icon=
"/com/intellij/uiDesigner/icons/panel.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JScrollPane"
icon=
"/com/intellij/uiDesigner/icons/scrollPane.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"7"
hsize-policy=
"7"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JButton"
icon=
"/com/intellij/uiDesigner/icons/button.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"0"
fill=
"1"
/>
<initial-values>
<property
name=
"text"
value=
"Button"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JRadioButton"
icon=
"/com/intellij/uiDesigner/icons/radioButton.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"RadioButton"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JCheckBox"
icon=
"/com/intellij/uiDesigner/icons/checkBox.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"3"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"CheckBox"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JLabel"
icon=
"/com/intellij/uiDesigner/icons/label.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"8"
fill=
"0"
/>
<initial-values>
<property
name=
"text"
value=
"Label"
/>
</initial-values>
</item>
<item
class=
"javax.swing.JTextField"
icon=
"/com/intellij/uiDesigner/icons/textField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JPasswordField"
icon=
"/com/intellij/uiDesigner/icons/passwordField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JFormattedTextField"
icon=
"/com/intellij/uiDesigner/icons/formattedTextField.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
>
<preferred-size
width=
"150"
height=
"-1"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextArea"
icon=
"/com/intellij/uiDesigner/icons/textArea.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTextPane"
icon=
"/com/intellij/uiDesigner/icons/textPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JEditorPane"
icon=
"/com/intellij/uiDesigner/icons/editorPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JComboBox"
icon=
"/com/intellij/uiDesigner/icons/comboBox.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"2"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JTable"
icon=
"/com/intellij/uiDesigner/icons/table.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JList"
icon=
"/com/intellij/uiDesigner/icons/list.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"2"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTree"
icon=
"/com/intellij/uiDesigner/icons/tree.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"150"
height=
"50"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JTabbedPane"
icon=
"/com/intellij/uiDesigner/icons/tabbedPane.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSplitPane"
icon=
"/com/intellij/uiDesigner/icons/splitPane.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"3"
hsize-policy=
"3"
anchor=
"0"
fill=
"3"
>
<preferred-size
width=
"200"
height=
"200"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JSpinner"
icon=
"/com/intellij/uiDesigner/icons/spinner.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"true"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSlider"
icon=
"/com/intellij/uiDesigner/icons/slider.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"8"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JSeparator"
icon=
"/com/intellij/uiDesigner/icons/separator.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"6"
anchor=
"0"
fill=
"3"
/>
</item>
<item
class=
"javax.swing.JProgressBar"
icon=
"/com/intellij/uiDesigner/icons/progressbar.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JToolBar"
icon=
"/com/intellij/uiDesigner/icons/toolbar.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"6"
anchor=
"0"
fill=
"1"
>
<preferred-size
width=
"-1"
height=
"20"
/>
</default-constraints>
</item>
<item
class=
"javax.swing.JToolBar$Separator"
icon=
"/com/intellij/uiDesigner/icons/toolbarSeparator.png"
removable=
"false"
auto-create-binding=
"false"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"0"
hsize-policy=
"0"
anchor=
"0"
fill=
"1"
/>
</item>
<item
class=
"javax.swing.JScrollBar"
icon=
"/com/intellij/uiDesigner/icons/scrollbar.png"
removable=
"false"
auto-create-binding=
"true"
can-attach-label=
"false"
>
<default-constraints
vsize-policy=
"6"
hsize-policy=
"0"
anchor=
"0"
fill=
"2"
/>
</item>
</group>
</component>
</project>
\ No newline at end of file
src/main/java/com/zorkdata/tools/kafka/CommonProducer.java
0 → 100644
View file @
36cb1379
package
com.zorkdata.tools.kafka
;
import
org.apache.kafka.clients.producer.KafkaProducer
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
CommonProducer
{
public
String
servers
=
"kafka-data1:9092,kafka-data2:9092,kafka-data2:9092"
;
public
int
batchSize
=
1
;
public
Producer
testProducer
;
public
String
metricTopic
;
public
String
errorLogTopic
;
public
String
errorMetricTopic
;
public
String
alarmTopic
;
public
String
defaultLogTopic
;
public
List
<
String
>
cep_change_event_logtypename
=
new
ArrayList
<
String
>();
public
String
cep_change_event_topic
;
public
static
Map
<
String
,
String
>
APPSYSTEM_TOPIC_MAP
=
new
HashMap
<
String
,
String
>();
public
static
Map
<
String
,
Map
<
String
,
String
>>
APPSYSTEM_SERVICE_TOPIC_MAP
=
new
HashMap
<
String
,
Map
<
String
,
String
>>();
static
int
partition
=
6
;
private
static
KafkaProducer
<
String
,
byte
[]>
producer
;
private
static
KafkaProducer
<
String
,
String
>
noAvroProducer
;
}
src/main/java/com/zorkdata/tools/kafka/Config.java
0 → 100644
View file @
36cb1379
package
com.zorkdata.tools.kafka
;
import
com.zorkdata.tools.utils.PropertiesUtil
;
import
java.util.Arrays
;
import
java.util.Set
;
public
class
Config
{
private
static
Config
instance
;
public
static
Config
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
Config
();
}
return
instance
;
}
private
String
kafkaServers
;
private
String
kafkaBathSize
;
private
Config
()
{
try
{
java
.
util
.
Properties
properties
=
PropertiesUtil
.
getProperties
(
"resources/config.properties"
);
kafkaServers
=
properties
.
getProperty
(
"kafka.servers"
);
kafkaBathSize
=
properties
.
getProperty
(
"kafka.batch.size"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
Config
.
getInstance
().
kafkaBathSize
);
}
}
src/main/java/com/zorkdata/tools/kafka/Producer.java
View file @
36cb1379
...
...
@@ -4,7 +4,6 @@ package com.zorkdata.tools.kafka;
import
org.apache.kafka.clients.producer.KafkaProducer
;
import
org.apache.kafka.clients.producer.ProducerRecord
;
import
javax.security.auth.login.Configuration
;
import
java.util.*
;
public
class
Producer
{
...
...
@@ -38,7 +37,9 @@ public class Producer {
props
.
put
(
"bootstrap.servers"
,
servers
);
props
.
put
(
"client.id"
,
"webAPI4LogGather"
);
props
.
put
(
"key.serializer"
,
"org.apache.kafka.common.serialization.StringSerializer"
);
props
.
put
(
"value.serializer"
,
"org.apache.kafka.common.serialization.ByteArraySerializer"
);
// props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props
.
put
(
"batch.size"
,
batchsize
);
producer
=
new
KafkaProducer
<
String
,
byte
[]>(
props
);
props
.
put
(
"value.serializer"
,
"org.apache.kafka.common.serialization.StringSerializer"
);
...
...
@@ -65,6 +66,14 @@ public class Producer {
e
.
printStackTrace
();
}
}
public
void
sendLog
(
String
topic
,
String
logJson
)
{
try
{
// producer.send(new ProducerRecord<String, String>(topic, null, logJson));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
sendErrorLog
(
String
logJson
)
{
try
{
...
...
@@ -95,7 +104,7 @@ public class Producer {
try
{
byte
[]
bytes
=
AvroSerializerFactory
.
getMetricAvorSerializer
().
serializingMetric
(
metricSetName
,
timestamp
,
dimensions
,
metrics
);
producer
.
send
(
new
ProducerRecord
<
String
,
byte
[]>(
metricTopic
,
""
,
bytes
));
//
producer.send(new ProducerRecord<String, byte[]>(metricTopic, "", bytes));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -106,7 +115,7 @@ public class Producer {
try
{
byte
[]
bytes
=
AvroSerializerFactory
.
getMetricAvorSerializer
().
serializingMetric
(
metricSetName
,
timestamp
,
dimensions
,
metrics
);
producer
.
send
(
new
ProducerRecord
<
String
,
byte
[]>(
topic
,
""
,
bytes
));
// producer.send(new ProducerRecord<String, byte[]>(topic, null
, bytes));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/java/com/zorkdata/tools/mock/MockFilebeatDataToKafka.java
View file @
36cb1379
package
com.zorkdata.tools.mock
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zorkdata.tools.kafka.Producer
;
import
com.zorkdata.tools.kafka.ProducerPool
;
import
com.zorkdata.tools.utils.DateUtil
;
import
org.apache.kafka.clients.producer.KafkaProducer
;
import
org.apache.kafka.clients.producer.ProducerRecord
;
import
org.apache.kafka.common.serialization.StringSerializer
;
...
...
@@ -9,8 +12,7 @@ import java.io.BufferedReader;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Properties
;
import
java.util.*
;
import
java.util.concurrent.ExecutionException
;
import
static
java
.
lang
.
System
.*;
...
...
@@ -158,11 +160,13 @@ public class MockFilebeatDataToKafka {
filebeatJson
.
put
(
"offset"
,
String
.
valueOf
(
currentTimeMillis
()));
filebeatJson
.
put
(
"message"
,
"10:06:41.335 功能请求 IP:182.140.129.3 MAC:F8A963586DFF 线程:00004364 通道ID:4 事务ID:16 请求:(0-98)集成客户校验(*) 营业部:(0001)国金证券集中交易(*)\\n66650109|************|XshR9/S5SDE=|8|0||12|7.37.0||||||||||0||0|182.140.129.3;PENGKANG;Administrator;83025;Intel(R)Core(TM)i7-4510UCPU@2.00GHz*4;bfebfbff00040651-GenuineIntel;Windows7 Service Pack 1 (Build 7601);182.140.129.3,0.0.0.0,0.0.0.0;F8A963586DFF,00FF8C535532,A0A8CD0D00B0;TF655AWJ16NG2L,143116404707;07/15/2014;8DC03929-0822-453C-A2D5-EFBE95E359BE;182.140.129.3;;NTFS;0C17-8FD7;C:;113G;HTS725050A7E630;GH2Z;TF655AWJ16NG2L;|||||2,Mar 1 2018,10:22:32|0|||GETLOGINPARAM||7.37,6.01,Mar 1 2018,10:37:07|8噝\\\\\\\\5\\\\\\\\3||||\\\\n10:06:41.491 调用失败 IP:182.140.129.3 MAC:F8A963586DFF 线程:00004364 通道ID:4 事务ID:16 请求:(0-98)集成客户校验(*) 营业部:(0001)国金证券集中交易(*) 耗时A:156 耗时B:0 排队:0\\\\n-4|资金账号或密码错误!|0|||\\\\n10:06:52.678 系统信息 开始关闭交易中心服务。\\\\n10:06:53.303 系统信息 (HS_TCP2.dll)连接守护线程退出!\\\\n10:06:53.335 系统信息 (HS_TCP2.dll)\\\\\\\"刷新约定购回标的证券信息\\\\\\\"线程成功退出!(记录总条数:3536)\\\\n10:06:54.413 系统信息 港股行情服务: 保存代码表(港股)缓存。\\\\n10:06:54.678 系统信息 深沪行情服务: 保存代码表缓存。\\\\n10:06:54.960 系统信息 交易中心服务已经成功关闭。\\\\n10:06:54.960 系统信息 系统正常关闭\\\\n"
);
filebeatJson
.
put
(
"appsystem"
,
"test_appsystem"
);
filebeatJson
.
put
(
"appprogramname"
,
"test_appprogramname"
);
filebeatJson
.
put
(
"logTypeName"
,
"test_topic_log"
);
filebeatJson
.
put
(
"servicename"
,
"test_servicename"
);
filebeatJson
.
put
(
"servicecode"
,
"test_cdde"
);
Random
random
=
new
Random
();
int
i
=
random
.
nextInt
(
10
);
filebeatJson
.
put
(
"appsystem"
,
"test_appsystem"
+
i
*
2
);
filebeatJson
.
put
(
"appprogramname"
,
"test_appprogramname"
+
i
*
3
);
filebeatJson
.
put
(
"logTypeName"
,
"test_topic_log"
+
i
*
4
);
filebeatJson
.
put
(
"servicename"
,
"test_servicename"
+
i
*
5
);
filebeatJson
.
put
(
"servicecode"
,
"test_cdde"
+
i
*
6
);
filebeatJson
.
put
(
"collectorruleid"
,
"1"
);
filebeatJson
.
put
(
"@metadata"
,
metadataJson
);
...
...
@@ -186,42 +190,51 @@ public class MockFilebeatDataToKafka {
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
InputStreamReader
is
=
new
InputStreamReader
(
in
);
BufferedReader
br
=
new
BufferedReader
(
is
);
topic
=
input
(
br
,
1
,
"请输入数据输入的topic名称(例如:topic100w)"
,
"请输入topic名称:"
);
brokerlist
=
input
(
br
,
2
,
"请输入kafka集群地址啊(例如:kafka01:9092,kafka02:9092,kafka03:9092),回车使用默认参数:"
,
"已使用默认参数:"
+
brokerlist
);
APP_SYSTEM
=
input
(
br
,
3
,
"请输入appSystem,回车使用默认参数:"
,
"已使用默认参数:"
+
APP_SYSTEM
);
APP_PROGRAM_NAME
=
input
(
br
,
4
,
"请输入appProgramName,回车使用默认参数:"
,
"已使用默认参数:"
+
APP_PROGRAM_NAME
);
CLUSTER_NAME
=
input
(
br
,
5
,
"请输入clusterName,回车使用默认参数:"
,
"已使用默认参数:"
+
CLUSTER_NAME
);
SERVICE_CODE
=
input
(
br
,
6
,
"请输入serviceName,回车使用默认参数:"
,
"已使用默认参数:"
+
SERVICE_CODE
);
IP
=
input
(
br
,
7
,
"请输入ip,回车使用默认参数:"
,
"已使用默认参数:"
+
IP
);
int
appSystemLength
=
Integer
.
parseInt
(
input
(
br
,
8
,
"请输入模拟appsystem个数(例如:10)"
,
"请输入大于零的数字"
));
int
appProgramNameLength
=
Integer
.
parseInt
(
input
(
br
,
9
,
"请输入模拟appProgramName个数(例如:10)"
,
"请输入大于零的数字"
));
int
clusterNameLength
=
Integer
.
parseInt
(
input
(
br
,
10
,
"请输入模拟clusterName个数(例如:10)"
,
"请输入大于零的数字"
));
int
serviceNameLength
=
Integer
.
parseInt
(
input
(
br
,
11
,
"请输入模拟serviceName个数(例如:10)"
,
"请输入大于零的数字"
));
int
ipLength
=
Integer
.
parseInt
(
input
(
br
,
12
,
"请输入模拟ip个数(例如:10)"
,
"请输入大于零的数字"
));
init
();
String
[]
appSystemArr
=
mockStrArr
(
APP_SYSTEM
,
appSystemLength
);
String
[]
appProgramNameArr
=
mockStrArr
(
APP_PROGRAM_NAME
,
appSystemLength
);
String
[]
clusterNameArr
=
mockStrArr
(
CLUSTER_NAME
,
appSystemLength
);
String
[]
serviceNameArr
=
mockStrArr
(
SERVICE_CODE
,
appSystemLength
);
String
[]
ipArr
=
mockStrArr
(
IP
,
appSystemLength
);
int
count
=
0
;
for
(
int
a
=
0
;
a
<
appSystemLength
;
a
++)
{
for
(
int
b
=
0
;
b
<
appProgramNameLength
;
b
++)
{
for
(
int
c
=
0
;
c
<
clusterNameLength
;
c
++)
{
for
(
int
d
=
0
;
d
<
serviceNameLength
;
d
++)
{
for
(
int
e
=
0
;
e
<
ipLength
;
e
++)
{
String
message
=
buildMsg
(
appSystemArr
[
a
],
appProgramNameArr
[
b
],
ipArr
[
e
],
clusterNameArr
[
d
],
serviceNameArr
[
c
]);
out
.
println
(
message
);
out
.
println
(++
count
);
send
(
message
);
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
IOException
,
InterruptedException
{
long
size
=
10000000
*
10
;
// long size = 1;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
String
json
=
buildMsg
();
Producer
producer
=
ProducerPool
.
getInstance
().
getProducer
();
producer
.
sendLog
(
"analysis1y"
,
json
);
}
Thread
.
sleep
(
1000
);
// InputStreamReader is = new InputStreamReader(in);
// BufferedReader br = new BufferedReader(is);
// topic = input(br, 1, "请输入数据输入的topic名称(例如:topic100w)", "请输入topic名称:");
// brokerlist = input(br, 2, "请输入kafka集群地址啊(例如:kafka01:9092,kafka02:9092,kafka03:9092),回车使用默认参数:", "已使用默认参数:" + brokerlist);
// APP_SYSTEM = input(br, 3, "请输入appSystem,回车使用默认参数:", "已使用默认参数:" + APP_SYSTEM);
// APP_PROGRAM_NAME = input(br, 4, "请输入appProgramName,回车使用默认参数:", "已使用默认参数:" + APP_PROGRAM_NAME);
// CLUSTER_NAME = input(br, 5, "请输入clusterName,回车使用默认参数:", "已使用默认参数:" + CLUSTER_NAME);
// SERVICE_CODE = input(br, 6, "请输入serviceName,回车使用默认参数:", "已使用默认参数:" + SERVICE_CODE);
// IP = input(br, 7, "请输入ip,回车使用默认参数:", "已使用默认参数:" + IP);
// int appSystemLength = Integer.parseInt(input(br, 8, "请输入模拟appsystem个数(例如:10)", "请输入大于零的数字"));
// int appProgramNameLength = Integer.parseInt(input(br, 9, "请输入模拟appProgramName个数(例如:10)", "请输入大于零的数字"));
// int clusterNameLength = Integer.parseInt(input(br, 10, "请输入模拟clusterName个数(例如:10)", "请输入大于零的数字"));
// int serviceNameLength = Integer.parseInt(input(br, 11, "请输入模拟serviceName个数(例如:10)", "请输入大于零的数字"));
// int ipLength = Integer.parseInt(input(br, 12, "请输入模拟ip个数(例如:10)", "请输入大于零的数字"));
// init();
// String[] appSystemArr = mockStrArr(APP_SYSTEM, appSystemLength);
// String[] appProgramNameArr = mockStrArr(APP_PROGRAM_NAME, appSystemLength);
// String[] clusterNameArr = mockStrArr(CLUSTER_NAME, appSystemLength);
// String[] serviceNameArr = mockStrArr(SERVICE_CODE, appSystemLength);
// String[] ipArr = mockStrArr(IP, appSystemLength);
// int count = 0;
// for (int a = 0; a < appSystemLength; a++) {
// for (int b = 0; b < appProgramNameLength; b++) {
// for (int c = 0; c < clusterNameLength; c++) {
// for (int d = 0; d < serviceNameLength; d++) {
// for (int e = 0; e < ipLength; e++) {
// String message = buildMsg(appSystemArr[a], appProgramNameArr[b], ipArr[e], clusterNameArr[d], serviceNameArr[c]);
// out.println(message);
// out.println(++count);
// send(message);
// }
// }
// }
// }
// }
}
public
static
String
input
(
BufferedReader
br
,
Integer
type
,
String
explain
,
String
errorExplain
)
throws
IOException
{
...
...
src/main/java/com/zorkdata/tools/mock/MockGrok.java
0 → 100644
View file @
36cb1379
package
com.zorkdata.tools.mock
;
public
class
MockGrok
{
}
src/main/java/com/zorkdata/tools/mock/MockStreamxLogAvro.java
View file @
36cb1379
...
...
@@ -76,7 +76,7 @@ public class MockStreamxLogAvro {
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
long
size
=
10000000
0
;
long
size
=
10000000
*
1
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
String
logTypeName
=
"streamx_log_avro"
;
...
...
@@ -91,7 +91,7 @@ public class MockStreamxLogAvro {
//System.out.println(printData(logTypeName, timestamp, source, offset, dimensions, measures, normalFields));
Producer
producer
=
ProducerPool
.
getInstance
().
getProducer
();
producer
.
sendLog
(
"log2metric1
0000w
"
,
logTypeName
,
timestamp
,
source
,
offset
,
dimensions
,
producer
.
sendLog
(
"log2metric1
y
"
,
logTypeName
,
timestamp
,
source
,
offset
,
dimensions
,
measures
,
normalFields
);
}
Thread
.
sleep
(
1000
);
...
...
src/main/java/com/zorkdata/tools/utils/PropertiesUtil.java
View file @
36cb1379
...
...
@@ -10,20 +10,21 @@ import java.util.Properties;
* @author DeleMing
*/
public
class
PropertiesUtil
{
private
final
static
String
UTF_8
=
"UTF-8"
;
/**
* 根据文件名获取该properties对象
*
* @param propertie
FileName
* @param propertie
sFileName 配置文件名称
* @return
*/
public
static
Properties
getProperties
(
String
propertieFileName
)
throws
Exception
{
public
static
Properties
getProperties
(
String
propertie
s
FileName
)
throws
Exception
{
Properties
properties
=
new
Properties
();
InputStream
inputStream
=
null
;
InputStreamReader
inputStreamReader
=
null
;
try
{
// inputStream = PropertiesUtil.class.getResourceAsStream(propertieFileName);
inputStream
=
new
FileInputStream
(
new
File
(
propertieFileName
));
inputStreamReader
=
new
InputStreamReader
(
inputStream
,
"UTF-8"
);
inputStream
=
new
FileInputStream
(
new
File
(
propertiesFileName
));
inputStreamReader
=
new
InputStreamReader
(
inputStream
,
UTF_8
);
properties
.
load
(
inputStreamReader
);
}
finally
{
if
(
inputStream
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment