Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
841c21fa
Commit
841c21fa
authored
Mar 19, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify kafka conf
parent
504a2d96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
collect_data.py
linucb/views/collect_data.py
+3
-5
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+4
-4
No files found.
linucb/views/collect_data.py
View file @
841c21fa
...
...
@@ -8,19 +8,17 @@ from linucb.views.linucb import LinUCB
import
json
from
trans2es.models.tag
import
TopicTag
import
traceback
from
django.conf
import
settings
class
KafkaManager
(
object
):
# kafka信息
kafka_broker_list
=
"192.168.13.114:9092,192.168.13.116:9092,192.168.13.115:9092"
topic_name
=
"alpha-maidian-data"
consumser_obj
=
None
@classmethod
def
get_kafka_consumer_ins
(
cls
,
topic_name
=
None
):
if
not
cls
.
consumser_obj
:
topic_name
=
cls
.
topic_name
if
not
topic_name
else
topic_name
cls
.
consumser_obj
=
KafkaConsumer
(
topic_name
,
bootstrap_servers
=
cls
.
kafka_broker_list
)
topic_name
=
settings
.
KAFKA_TOPIC_NAME
if
not
topic_name
else
topic_name
cls
.
consumser_obj
=
KafkaConsumer
(
topic_name
,
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
)
# cls.consumser_obj.subscribe([topic_name])
return
cls
.
consumser_obj
...
...
trans2es/management/commands/trans2es_mapping2es.py
View file @
841c21fa
...
...
@@ -41,11 +41,11 @@ class Command(BaseCommand):
official_index_name
=
ESPerform
.
get_official_index_name
(
type_name
)
index_exists
=
es_cli
.
indices
.
exists
(
official_index_name
)
if
not
index_exists
:
logging
.
info
(
"begin create [
%
s] index
and mapping
!"
%
type_name
)
logging
.
info
(
"begin create [
%
s] index!"
%
type_name
)
ESPerform
.
create_index
(
es_cli
,
type_name
)
ESPerform
.
put_index_mapping
(
es_cli
,
type_name
)
else
:
logging
.
warning
(
"index:[
%
s] has already existing!"
%
type_nam
e
)
logging
.
info
(
"begin create [
%
s] mapping!"
%
type_name
)
ESPerform
.
put_index_mapping
(
es_cli
,
type_name
,
force_sync
=
Tru
e
)
if
len
(
options
[
"indices_template"
]):
...
...
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