Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
logtransfer
Project
Project
Details
Activity
Releases
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
谢宇轩
logtransfer
Commits
2f629632
Commit
2f629632
authored
Feb 29, 2024
by
谢宇轩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加docker-compose
parent
1fac12f1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
228 additions
and
5 deletions
+228
-5
.gitignore
.gitignore
+2
-1
docker-compose.yml
docker-compose.yml
+81
-0
etcdctl
etcdctl
+5
-0
register.go
plugin/register.go
+4
-4
default.yml
resources/ccenter/config/default.yml
+19
-0
my.cfg
resources/docker/config/my.cfg
+16
-0
schema.sql
resources/schema/schema.sql
+101
-0
No files found.
.gitignore
View file @
2f629632
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
*.exe
*.exe
/log
/log
logtransfer.conf
logtransfer.conf
./logtransfer
./logtransfer
\ No newline at end of file
./resources/docker/data/*
\ No newline at end of file
docker-compose.yml
0 → 100644
View file @
2f629632
version
:
"
3.7"
services
:
etcd0
:
image
:
"
bitnami/etcd:latest"
container_name
:
heimdallr_etcd0
ports
:
-
"
23800:2380"
-
"
23790:2379"
volumes
:
-
"
./resources/docker/data/etcd0:/bitnami/etcd"
environment
:
-
ALLOW_NONE_AUTHENTICATION=yes
-
ETCD_NAME=heimdallr_etcd0
-
ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
-
ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
-
ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:23790
-
ETCD_INITIAL_ADVERTISE_PEER_URLS=http://heimdallr_etcd0:2380
-
ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
-
ETCD_INITIAL_CLUSTER=heimdallr_etcd0=http://heimdallr_etcd0:2380,heimdallr_etcd1=http://heimdallr_etcd1:2380
-
ETCD_INITIAL_CLUSTER_STATE=new
etcd1
:
image
:
"
bitnami/etcd:latest"
container_name
:
heimdallr_etcd1
ports
:
-
"
23801:2380"
-
"
23791:2379"
volumes
:
-
"
./resources/docker/data/etcd1:/bitnami/etcd"
environment
:
-
ALLOW_NONE_AUTHENTICATION=yes
-
ETCD_NAME=heimdallr_etcd1
-
ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
-
ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
-
ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:23791
-
ETCD_INITIAL_ADVERTISE_PEER_URLS=http://heimdallr_etcd1:2380
-
ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
-
ETCD_INITIAL_CLUSTER=heimdallr_etcd0=http://heimdallr_etcd0:2380,heimdallr_etcd1=http://heimdallr_etcd1:2380
-
ETCD_INITIAL_CLUSTER_STATE=new
mysql
:
image
:
mysql:8.0.31
ports
:
-
"
33076:3306"
environment
:
-
MYSQL_DATABASE=ccenter
-
MYSQL_ROOT_PASSWORD=ccenter_root_0229
volumes
:
-
"
./resources/docker/data/mysql:/var/lib/mysql"
-
"
./resources/docker/config/my.cfg:/etc/mysql/conf.d/config-file.cnf"
-
"
./resources/schema/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql"
healthcheck
:
test
:
[
"
CMD"
,
"
mysqladmin"
,
"
ping"
,
"
--silent"
]
interval
:
10s
timeout
:
5s
retries
:
5
container_name
:
heimdallr_mysql
ccenter
:
image
:
docker.ijiwei.com/logagent/ccenter-dashboard:latest
depends_on
:
-
ccenter_api
ports
:
-
"
9480:8001"
environment
:
-
CCENTER_API_HOST=heimdallr_ccenter_api:9090
-
SERVER_PORT=8001
-
SERVER_NAME=dashboard.ccenter.ijiwei.com
container_name
:
heimdallr_ccenter
ccenter_api
:
image
:
docker.ijiwei.com/logagent/ccenter:latest
depends_on
:
mysql
:
condition
:
service_healthy
ports
:
-
"
9481:9090"
volumes
:
-
"
./resources/ccenter/config/default.yml:/app/config/default.yml"
environment
:
-
APPENV=prod
container_name
:
heimdallr_ccenter_api
\ No newline at end of file
etcdctl
0 → 100755
View file @
2f629632
#! /usr/local/bin sh
set -e
set -- docker exec etcd1 /bin/sh -c "etcdctl --endpoints=http://etcd0:2379,http://etcd1:2379 $@"
\ No newline at end of file
plugin/register.go
View file @
2f629632
...
@@ -5,19 +5,19 @@ var RegistedPlugins = getRegistedPlugins()
...
@@ -5,19 +5,19 @@ var RegistedPlugins = getRegistedPlugins()
// 获取注册过的插件插件列表
// 获取注册过的插件插件列表
func
getRegistedPlugins
()
map
[
string
]
HandlerConstruct
{
func
getRegistedPlugins
()
map
[
string
]
HandlerConstruct
{
return
map
[
string
]
HandlerConstruct
{
return
map
[
string
]
HandlerConstruct
{
"Dump"
:
func
()
Handler
{
"Dump"
:
func
()
Handler
{
return
&
Dump
{}
return
&
Dump
{}
},
},
"Edit"
:
func
()
Handler
{
"Edit"
:
func
()
Handler
{
return
&
Edit
{}
return
&
Edit
{}
},
},
"SaveES"
:
func
()
Handler
{
"SaveES"
:
func
()
Handler
{
return
&
SaveES
{}
return
&
SaveES
{}
},
},
"Alarm"
:
func
()
Handler
{
"Alarm"
:
func
()
Handler
{
return
&
Alarm
{}
return
&
Alarm
{}
},
},
"DingRobot"
:
func
()
Handler
{
"DingRobot"
:
func
()
Handler
{
return
&
Ding
{}
return
&
Ding
{}
},
},
}
}
...
...
resources/ccenter/config/default.yml
0 → 100644
View file @
2f629632
etcd
:
local
:
address
:
"
47.119.124.57:23790,47.119.124.57:23791"
prod
:
address
:
"
heimdallr_etcd0:2379,heimdallr_etcd1:2379"
mysql
:
local
:
host
:
localhost
port
:
33069
db
:
ccenter
user
:
root
password
:
root
prod
:
host
:
heimdallr_mysql
port
:
3306
db
:
ccenter
user
:
root
password
:
ccenter_root_0229
resources/docker/config/my.cfg
0 → 100755
View file @
2f629632
[mysqld]
bind-address = 0.0.0.0
innodb_buffer_pool_size = 1024M
default_authentication_plugin=mysql_native_password
# Unicode
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
resources/schema/schema.sql
0 → 100755
View file @
2f629632
/*
Navicat MySQL Data Transfer
Source Server : 47.106.69.239
Source Server Version : 50556
Source Host : 47.106.69.239:3306
Source Database : jiwei
Target Server Type : MYSQL
Target Server Version : 50556
File Encoding : 65001
Date: 2021-03-16 15:46:17
*/
SET
FOREIGN_KEY_CHECKS
=
0
;
-- ----------------------------
-- Table structure for collectors
-- ----------------------------
DROP
TABLE
IF
EXISTS
`collectors`
;
CREATE
TABLE
`collectors`
(
`id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`path`
varchar
(
155
)
DEFAULT
NULL
,
`type`
enum
(
'File'
,
'Date'
)
NOT
NULL
DEFAULT
'File'
COMMENT
'1 FILE 2 DATE'
,
`topic`
varchar
(
55
)
DEFAULT
NULL
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
`logagent_id`
int
(
10
)
unsigned
NOT
NULL
,
`topic_id`
int
(
10
)
unsigned
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
KEY
`agent_collector`
(
`logagent_id`
),
KEY
`topic_collector`
(
`topic_id`
),
CONSTRAINT
`topic_collector`
FOREIGN
KEY
(
`topic_id`
)
REFERENCES
`topics`
(
`id`
)
ON
UPDATE
CASCADE
,
CONSTRAINT
`agent_collector`
FOREIGN
KEY
(
`logagent_id`
)
REFERENCES
`logagents`
(
`id`
)
ON
UPDATE
CASCADE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
58
DEFAULT
CHARSET
=
utf8mb4
;
-- ----------------------------
-- Table structure for logagents
-- ----------------------------
DROP
TABLE
IF
EXISTS
`logagents`
;
CREATE
TABLE
`logagents`
(
`id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`node_name`
varchar
(
55
)
DEFAULT
NULL
,
`label`
varchar
(
55
)
DEFAULT
NULL
,
`status`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
13
DEFAULT
CHARSET
=
utf8mb4
;
-- ----------------------------
-- Table structure for plugins
-- ----------------------------
DROP
TABLE
IF
EXISTS
`plugins`
;
CREATE
TABLE
`plugins`
(
`id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
55
)
DEFAULT
NULL
,
`label`
varchar
(
55
)
DEFAULT
NULL
,
`is_default`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
`need_params`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'0 不必须参数 1 必须 2 以上为数量'
,
PRIMARY
KEY
(
`id`
),
KEY
`deafult_index`
(
`is_default`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
6
DEFAULT
CHARSET
=
utf8mb4
;
INSERT
INTO
`ccenter`
.
`plugins`
(
`id`
,
`name`
,
`label`
,
`is_default`
,
`created_at`
,
`updated_at`
,
`need_params`
)
VALUES
(
1
,
'Dump'
,
'打印输出'
,
0
,
'2021-07-15 18:05:10'
,
'2021-11-26 11:34:22'
,
0
);
INSERT
INTO
`ccenter`
.
`plugins`
(
`id`
,
`name`
,
`label`
,
`is_default`
,
`created_at`
,
`updated_at`
,
`need_params`
)
VALUES
(
2
,
'SaveES'
,
'持久化分析'
,
0
,
'2021-07-15 18:05:13'
,
'2021-12-10 17:55:25'
,
1
);
INSERT
INTO
`ccenter`
.
`plugins`
(
`id`
,
`name`
,
`label`
,
`is_default`
,
`created_at`
,
`updated_at`
,
`need_params`
)
VALUES
(
3
,
'Edit'
,
'格式化'
,
0
,
'2021-07-15 18:05:15'
,
'2021-12-10 17:55:26'
,
1
);
INSERT
INTO
`ccenter`
.
`plugins`
(
`id`
,
`name`
,
`label`
,
`is_default`
,
`created_at`
,
`updated_at`
,
`need_params`
)
VALUES
(
4
,
'Alarm'
,
'阈值报警'
,
0
,
'2021-07-15 18:05:19'
,
'2021-12-10 17:55:16'
,
1
);
INSERT
INTO
`ccenter`
.
`plugins`
(
`id`
,
`name`
,
`label`
,
`is_default`
,
`created_at`
,
`updated_at`
,
`need_params`
)
VALUES
(
5
,
'DingRobot'
,
'钉钉通知'
,
0
,
'2021-07-15 18:05:22'
,
'2023-01-28 17:55:37'
,
1
);
-- ----------------------------
-- Table structure for topic_plugins
-- ----------------------------
DROP
TABLE
IF
EXISTS
`topic_plugins`
;
CREATE
TABLE
`topic_plugins`
(
`topic_id`
int
(
10
)
unsigned
NOT
NULL
,
`plugin_id`
int
(
10
)
unsigned
NOT
NULL
,
`sort_num`
smallint
(
3
)
unsigned
DEFAULT
NULL
,
`params`
varchar
(
255
)
DEFAULT
''
COMMENT
'插件函数需要的参数'
,
PRIMARY
KEY
(
`plugin_id`
,
`topic_id`
),
KEY
`topic_index`
(
`topic_id`
),
KEY
`plugin_index`
(
`plugin_id`
)
USING
BTREE
,
CONSTRAINT
`plugin_index`
FOREIGN
KEY
(
`plugin_id`
)
REFERENCES
`plugins`
(
`id`
)
ON
UPDATE
CASCADE
,
CONSTRAINT
`topic_index`
FOREIGN
KEY
(
`topic_id`
)
REFERENCES
`topics`
(
`id`
)
ON
UPDATE
CASCADE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
-- ----------------------------
-- Table structure for topics
-- ----------------------------
DROP
TABLE
IF
EXISTS
`topics`
;
CREATE
TABLE
`topics`
(
`id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
155
)
DEFAULT
NULL
,
`label`
varchar
(
155
)
DEFAULT
NULL
,
`transfer_format`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'0 默认 1 json 2 Key:word'
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
15
DEFAULT
CHARSET
=
utf8mb4
;
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