Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xxl-job
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
刘晓滨
xxl-job
Commits
2aa482d9
Commit
2aa482d9
authored
Jan 17, 2022
by
刘晓滨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'perf_colony_0114_chs' into 'master'
perf(admin.springboot):集群部署 See merge request
!17
parents
d1e9ab1b
8924cb9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
3 deletions
+29
-3
XxlJobAdminApplication.java
...c/main/java/com/xxl/job/admin/XxlJobAdminApplication.java
+5
-1
application.properties
xxl-job-admin/src/main/resources/application.properties
+1
-1
XxlJobExecutorApplication.java
.../java/com/xxl/job/executor/XxlJobExecutorApplication.java
+22
-0
application.properties
...mple-springboot/src/main/resources/application.properties
+1
-1
No files found.
xxl-job-admin/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java
View file @
2aa482d9
...
...
@@ -25,6 +25,10 @@ public class XxlJobAdminApplication {
if
(
args
==
null
||
args
.
length
==
0
){
throw
new
RuntimeException
(
"请传入zookeeper的地址"
);
}
if
(
args
.
length
<
2
){
throw
new
RuntimeException
(
"请传入项目启动的端口号---第二个参数"
);
}
System
.
setProperty
(
"server.port"
,
args
[
1
]);
ZookeeperClientUtil
.
init
(
args
[
0
],
"/weixt/conf"
);
// 创建zookeeper客户端
ZookeeperClientUtil
configurationClient
=
new
ZookeeperClientUtil
();
...
...
@@ -34,7 +38,7 @@ public class XxlJobAdminApplication {
}
private
static
void
setSystemPropertie
(
ZookeeperClientUtil
configurationClient
,
String
key
){
String
value
=
configurationClient
.
getData
(
configurationClient
.
mainPath
+
"/"
+
key
);
String
value
=
configurationClient
.
getData
(
ZookeeperClientUtil
.
mainPath
+
"/"
+
key
);
if
(
StringUtils
.
isEmpty
(
value
)){
throw
new
RuntimeException
(
"zookeeper中没有该属性的值:"
+
key
);
}
...
...
xxl-job-admin/src/main/resources/application.properties
View file @
2aa482d9
### web
server.port
=
8181
#
server.port=8181
server.context-path
=
/xxl-job-admin
### resources
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/XxlJobExecutorApplication.java
View file @
2aa482d9
...
...
@@ -4,6 +4,7 @@ import com.alibaba.dubbo.common.utils.ConfigUtils;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
java.util.Arrays
;
import
java.util.Properties
;
/**
...
...
@@ -14,9 +15,30 @@ public class XxlJobExecutorApplication {
public
static
void
main
(
String
[]
args
)
{
initZookeeperAddres
(
args
);
setAdminAddres
(
args
);
SpringApplication
.
run
(
XxlJobExecutorApplication
.
class
,
args
);
}
private
static
void
setAdminAddres
(
String
[]
args
){
// xxl.job.admin.addresses=http://127.0.0.1:8181/xxl-job-admin
String
adminAddres
=
getAdminAddres
(
args
);
System
.
out
.
println
(
adminAddres
);
System
.
setProperty
(
"xxl.job.admin.addresses"
,
adminAddres
);
}
private
static
String
getAdminAddres
(
String
[]
args
){
if
(
args
.
length
<
2
){
throw
new
RuntimeException
(
"请输入调度中心的端口,如果是多个(集群)使用逗号(,)进行间隔"
);
}
String
[]
portArr
=
args
[
1
].
split
(
","
);
StringBuilder
resultBuilder
=
new
StringBuilder
();
for
(
String
port
:
portArr
)
{
resultBuilder
.
append
(
"http://127.0.0.1:"
+
port
+
"/xxl-job-admin,"
);
}
String
resultStr
=
resultBuilder
.
deleteCharAt
(
resultBuilder
.
length
()
-
1
).
toString
();
return
resultStr
;
}
/**
* 促使化dubbo注册中心的地址
* @param args
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
View file @
2aa482d9
...
...
@@ -6,7 +6,7 @@ logging.config=classpath:logback.xml
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl.job.admin.addresses
=
http://127.0.0.1:8181/xxl-job-admin
#
xxl.job.admin.addresses=http://127.0.0.1:8181/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname
=
com-spacetech-service-xxl-job-springboot
...
...
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