Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
ee65e002
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee65e002
编写于
1月 13, 2017
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:#75
上级
cffa3e1d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
56 addition
and
10 deletion
+56
-10
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/assist/NetUtils.java
...n/java/com/a/eye/skywalking/registry/assist/NetUtils.java
+12
-2
skywalking-network/src/main/java/com/a/eye/skywalking/network/Server.java
...rk/src/main/java/com/a/eye/skywalking/network/Server.java
+7
-4
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/Main.java
...ting/src/main/java/com/a/eye/skywalking/routing/Main.java
+14
-2
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/config/Config.java
...main/java/com/a/eye/skywalking/routing/config/Config.java
+3
-0
skywalking-storage-center/skywalking-routing/src/main/resources/config.properties
...r/skywalking-routing/src/main/resources/config.properties
+2
-0
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/Main.java
...rage/src/main/java/com/a/eye/skywalking/storage/Main.java
+14
-2
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/config/Config.java
...main/java/com/a/eye/skywalking/storage/config/Config.java
+2
-0
skywalking-storage-center/skywalking-storage/src/main/resources/config.properties
...r/skywalking-storage/src/main/resources/config.properties
+2
-0
未找到文件。
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/assist/NetUtils.java
浏览文件 @
ee65e002
...
...
@@ -15,7 +15,7 @@ public class NetUtils {
private
static
ILog
logger
=
LogManager
.
getLogger
(
NetUtils
.
class
);
public
static
final
String
LOCALHOST
=
"127.0.0.1"
;
p
ublic
static
final
String
ANYHOST
=
"0.0.0.0"
;
p
rivate
static
final
String
[]
ANY_HOST
=
{
"0.0.0.0"
,
"::0"
}
;
private
static
final
Pattern
IP_PATTERN
=
Pattern
.
compile
(
"\\d{1,3}(\\.\\d{1,3}){3,5}$"
);
public
static
InetAddress
getLocalAddress
()
{
...
...
@@ -68,6 +68,16 @@ public class NetUtils {
return
false
;
String
name
=
address
.
getHostAddress
();
// 不能是0.0.0.0 也不能是127.0.0.1 并且还得符合IP的正则
return
(
name
!=
null
&&
!
ANYHOST
.
equals
(
name
)
&&
!
LOCALHOST
.
equals
(
name
)
&&
IP_PATTERN
.
matcher
(
name
).
matches
());
return
(
name
!=
null
&&
!
isAnyHost
(
name
)
&&
!
LOCALHOST
.
equals
(
name
)
&&
IP_PATTERN
.
matcher
(
name
).
matches
());
}
public
static
boolean
isAnyHost
(
String
host
){
for
(
String
s
:
ANY_HOST
)
{
if
(
s
.
equals
(
host
)){
return
true
;
}
}
return
false
;
}
}
skywalking-network/src/main/java/com/a/eye/skywalking/network/Server.java
浏览文件 @
ee65e002
...
...
@@ -5,10 +5,12 @@ import com.a.eye.skywalking.network.grpc.server.SpanStorageServer;
import
com.a.eye.skywalking.network.grpc.server.TraceSearchServer
;
import
com.a.eye.skywalking.network.listener.server.SpanStorageServerListener
;
import
com.a.eye.skywalking.network.listener.server.TraceSearchListener
;
import
io.grpc.netty.NettyServerBuilder
;
import
io.netty.channel.nio.NioEventLoopGroup
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
public
class
Server
{
private
io
.
grpc
.
Server
server
;
...
...
@@ -33,13 +35,14 @@ public class Server {
}
}
public
static
TransferServiceBuilder
newBuilder
(
int
port
)
{
return
new
TransferServiceBuilder
(
port
);
public
static
TransferServiceBuilder
newBuilder
(
String
host
,
int
port
)
{
return
new
TransferServiceBuilder
(
host
,
port
);
}
public
static
class
TransferServiceBuilder
{
private
TransferServiceBuilder
(
int
port
)
{
serverBuilder
=
NettyServerBuilder
.
forPort
(
port
);
private
TransferServiceBuilder
(
String
host
,
int
port
)
{
serverBuilder
=
NettyServerBuilder
.
forAddress
(
new
InetSocketAddress
(
host
,
port
));
serverBuilder
.
maxConcurrentCallsPerConnection
(
4
);
}
...
...
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/Main.java
浏览文件 @
ee65e002
...
...
@@ -19,6 +19,8 @@ import java.io.IOException;
import
java.util.Map
;
import
java.util.Properties
;
import
static
com
.
a
.
eye
.
skywalking
.
registry
.
assist
.
NetUtils
.
isAnyHost
;
/**
* Main Class of the routing server.
* It starts server in a sequence:
...
...
@@ -46,9 +48,11 @@ public class Main {
center
.
start
(
fetchRegistryCenterConfig
());
center
.
subscribe
(
Config
.
StorageNode
.
SUBSCRIBE_PATH
,
RoutingService
.
getRouter
());
Server
.
newBuilder
(
Config
.
Server
.
PORT
).
addSpanStorageService
(
new
SpanStorageListenerImpl
()).
addTraceSearchService
(
new
TraceSearchListenerImpl
()).
build
().
start
();
Server
.
newBuilder
(
Config
.
Server
.
HOST
,
Config
.
Server
.
PORT
).
addSpanStorageService
(
new
SpanStorageListenerImpl
()).
addTraceSearchService
(
new
TraceSearchListenerImpl
()).
build
().
start
();
center
.
register
(
Config
.
RegistryCenter
.
PATH_PREFIX
+
NetUtils
.
getLocalAddress
().
getHostAddress
()
+
":"
+
Config
.
Server
.
PORT
);
center
.
register
(
Config
.
RegistryCenter
.
PATH_PREFIX
+
fetchHostOfStorageServerBinding
()
+
":"
+
Config
.
Server
.
PORT
);
logger
.
info
(
"Skywalking routing service was started."
);
Thread
.
currentThread
().
join
();
}
catch
(
Exception
e
)
{
...
...
@@ -60,6 +64,14 @@ public class Main {
}
}
private
static
String
fetchHostOfStorageServerBinding
(){
if
(
isAnyHost
(
Config
.
Server
.
HOST
)){
return
NetUtils
.
getLocalAddress
().
getHostAddress
();
}
return
Config
.
Server
.
HOST
;
}
private
static
void
initConfig
()
throws
IllegalAccessException
,
IOException
{
Properties
properties
=
new
Properties
();
try
{
...
...
skywalking-storage-center/skywalking-routing/src/main/java/com/a/eye/skywalking/routing/config/Config.java
浏览文件 @
ee65e002
...
...
@@ -2,6 +2,9 @@ package com.a.eye.skywalking.routing.config;
public
class
Config
{
public
static
class
Server
{
public
static
String
HOST
=
"0.0.0.0"
;
public
static
int
PORT
=
23000
;
public
static
String
REST_SERVICE_HOST
=
"0.0.0.0"
;
...
...
skywalking-storage-center/skywalking-routing/src/main/resources/config.properties
浏览文件 @
ee65e002
# the host that routing server binding
#server.host=0.0.0.0
# the port which routing server listening
server.port
=
23000
# the ip that rest api service binding
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/Main.java
浏览文件 @
ee65e002
...
...
@@ -22,6 +22,7 @@ import java.io.IOException;
import
java.util.Map
;
import
java.util.Properties
;
import
static
com
.
a
.
eye
.
skywalking
.
registry
.
assist
.
NetUtils
.
isAnyHost
;
import
static
com
.
a
.
eye
.
skywalking
.
storage
.
config
.
Config
.
RegistryCenter
.
PATH_PREFIX
;
/**
...
...
@@ -48,7 +49,9 @@ public class Main {
DataFilesManager
.
init
();
server
=
Server
.
newBuilder
(
Config
.
Server
.
PORT
).
addSpanStorageService
(
new
StorageListener
())
server
=
Server
.
newBuilder
(
Config
.
Server
.
HOST
,
Config
.
Server
.
PORT
)
.
addSpanStorageService
(
new
StorageListener
())
.
addAsyncTraceSearchService
(
new
SearchListener
()).
build
();
server
.
start
();
...
...
@@ -77,7 +80,16 @@ public class Main {
registerConfig
.
setProperty
(
ZookeeperConfig
.
AUTH_SCHEMA
,
Config
.
RegistryCenter
.
AUTH_SCHEMA
);
registerConfig
.
setProperty
(
ZookeeperConfig
.
AUTH_INFO
,
Config
.
RegistryCenter
.
AUTH_INFO
);
registryCenter
.
start
(
registerConfig
);
registryCenter
.
register
(
PATH_PREFIX
+
NetUtils
.
getLocalAddress
().
getHostAddress
()
+
":"
+
Config
.
Server
.
PORT
);
registryCenter
.
register
(
PATH_PREFIX
+
fetchHostOfStorageServerBinding
()
+
":"
+
Config
.
Server
.
PORT
);
}
private
static
String
fetchHostOfStorageServerBinding
(){
if
(
isAnyHost
(
Config
.
Server
.
HOST
)){
return
NetUtils
.
getLocalAddress
().
getHostAddress
();
}
return
Config
.
Server
.
HOST
;
}
private
static
void
initConfig
()
throws
IllegalAccessException
,
IOException
{
...
...
skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/config/Config.java
浏览文件 @
ee65e002
...
...
@@ -5,6 +5,8 @@ package com.a.eye.skywalking.storage.config;
*/
public
class
Config
{
public
static
class
Server
{
public
static
String
HOST
=
"0.0.0.0"
;
public
static
int
PORT
=
34000
;
}
...
...
skywalking-storage-center/skywalking-storage/src/main/resources/config.properties
浏览文件 @
ee65e002
# the host that storage server binding
#server.host=0.0.0.0
# the port which storage server listening
server.port
=
34000
#
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录