Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Skyeye云
Skyeye
提交
a7fdd414
S
Skyeye
项目概览
Skyeye云
/
Skyeye
通知
1434
Star
162
Fork
130
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Skyeye
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a7fdd414
编写于
11月 17, 2018
作者:
Skyeye云
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加redis信息查看
上级
fa3c84da
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
443 addition
and
1 deletion
+443
-1
skyeye-service/src/main/java/com/skyeye/authority/service/SysRedisMonitorService.java
.../com/skyeye/authority/service/SysRedisMonitorService.java
+12
-0
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysRedisMonitorServiceImpl.java
...ye/authority/service/impl/SysRedisMonitorServiceImpl.java
+62
-0
skyeye-service/src/main/java/com/skyeye/jedis/JedisClient.java
...e-service/src/main/java/com/skyeye/jedis/JedisClient.java
+59
-0
skyeye-service/src/main/java/com/skyeye/jedis/JedisClientClusterService.java
...main/java/com/skyeye/jedis/JedisClientClusterService.java
+12
-0
skyeye-service/src/main/java/com/skyeye/jedis/impl/JedisClientCluster.java
...c/main/java/com/skyeye/jedis/impl/JedisClientCluster.java
+160
-1
skyeye-service/src/main/java/com/skyeye/jedis/impl/JedisClientPool.java
.../src/main/java/com/skyeye/jedis/impl/JedisClientPool.java
+82
-0
skyeye-web/src/main/java/com/skyeye/authority/controller/SysRedisMonitorController.java
...kyeye/authority/controller/SysRedisMonitorController.java
+51
-0
skyeye-web/src/main/resources/mapping/reqmapping.xml
skyeye-web/src/main/resources/mapping/reqmapping.xml
+5
-0
未找到文件。
skyeye-service/src/main/java/com/skyeye/authority/service/SysRedisMonitorService.java
0 → 100644
浏览文件 @
a7fdd414
package
com.skyeye.authority.service
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
public
interface
SysRedisMonitorService
{
public
void
queryRedisInfoList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
public
void
queryRedisLogsList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
;
}
skyeye-service/src/main/java/com/skyeye/authority/service/impl/SysRedisMonitorServiceImpl.java
0 → 100644
浏览文件 @
a7fdd414
package
com.skyeye.authority.service.impl
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONArray
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.skyeye.authority.service.SysRedisMonitorService
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
import
com.skyeye.jedis.JedisClient
;
import
com.skyeye.jedis.JedisClientClusterService
;
@Service
public
class
SysRedisMonitorServiceImpl
implements
SysRedisMonitorService
{
@Autowired
public
JedisClient
jedisClient
;
@Autowired
public
JedisClientClusterService
jedisClientClusterService
;
/**
*
* @Title: queryRedisInfoList
* @Description: 获取redis服务器信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings
(
"unchecked"
)
@Override
public
void
queryRedisInfoList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
//获取redis服务器信息
String
info
=
jedisClient
.
getRedisInfo
();
List
<
Map
<
String
,
Object
>>
beans
=
JSONArray
.
fromObject
(
info
);
outputObject
.
setBeans
(
beans
);
}
/**
*
* @Title: queryRedisLogsList
* @Description: 获取redis日志信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public
void
queryRedisLogsList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
List
<
Map
<
String
,
Object
>>
beans
=
jedisClientClusterService
.
getClusterNodes
();
outputObject
.
setBeans
(
beans
);
}
}
skyeye-service/src/main/java/com/skyeye/jedis/JedisClient.java
浏览文件 @
a7fdd414
package
com.skyeye.jedis
;
import
java.util.List
;
import
redis.clients.util.Slowlog
;
public
interface
JedisClient
{
...
...
@@ -120,4 +124,59 @@ public interface JedisClient {
*/
public
Long
del
(
String
key
);
/**
*
* @Title: getRedisInfo
* @Description: 获取redis 服务器信息
* @param @return
* @param @throws Exception 参数
* @return String 返回类型
* @throws
*/
public
String
getRedisInfo
();
/**
*
* @Title: getLogs
* @Description: 获取日志列表
* @param @param entries
* @param @return
* @param @throws Exception 参数
* @return List<Slowlog> 返回类型
* @throws
*/
public
List
<
Slowlog
>
getLogs
(
long
entries
);
/**
*
* @Title: getLogsLen
* @Description: 获取日志条数
* @param @return
* @param @throws Exception 参数
* @return Long 返回类型
* @throws
*/
public
Long
getLogsLen
();
/**
*
* @Title: logEmpty
* @Description: 清空日志
* @param @return
* @param @throws Exception 参数
* @return String 返回类型
* @throws
*/
public
String
logEmpty
();
/**
*
* @Title: dbSize
* @Description: 获取占用内存大小
* @param @return
* @param @throws Exception 参数
* @return Long 返回类型
* @throws
*/
public
Long
dbSize
();
}
skyeye-service/src/main/java/com/skyeye/jedis/JedisClientClusterService.java
0 → 100644
浏览文件 @
a7fdd414
package
com.skyeye.jedis
;
import
java.util.List
;
import
java.util.Map
;
import
redis.clients.jedis.JedisPool
;
public
interface
JedisClientClusterService
{
public
List
<
Map
<
String
,
Object
>>
getClusterNodes
()
throws
Exception
;
}
skyeye-service/src/main/java/com/skyeye/jedis/impl/JedisClientCluster.java
浏览文件 @
a7fdd414
package
com.skyeye.jedis.impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
net.sf.json.JSONArray
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
com.skyeye.jedis.JedisClient
;
import
com.skyeye.jedis.JedisClientClusterService
;
import
redis.clients.jedis.Client
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisCluster
;
import
redis.clients.jedis.JedisPool
;
import
redis.clients.util.Slowlog
;
public
class
JedisClientCluster
implements
JedisClient
{
/**
*
* @ClassName: JedisClientCluster
* @Description: redis集群
* @author 卫志强
* @date 2018年11月17日
*
*/
public
class
JedisClientCluster
implements
JedisClient
,
JedisClientClusterService
{
@Autowired
private
JedisCluster
jedisCluster
;
@Value
(
"${redis.ip1}"
)
private
String
redisIp1
;
@Value
(
"${redis.ip2}"
)
private
String
redisIp2
;
@Value
(
"${redis.ip3}"
)
private
String
redisIp3
;
@Value
(
"${redis.ip4}"
)
private
String
redisIp4
;
@Value
(
"${redis.ip5}"
)
private
String
redisIp5
;
@Value
(
"${redis.ip6}"
)
private
String
redisIp6
;
@Override
public
String
set
(
String
key
,
String
value
)
{
...
...
@@ -58,5 +101,121 @@ public class JedisClientCluster implements JedisClient {
public
Long
del
(
String
key
)
{
return
jedisCluster
.
del
(
key
);
}
@Override
public
String
getRedisInfo
()
{
Jedis
jedis
=
null
;
try
{
Map
<
String
,
JedisPool
>
jedisPools
=
jedisCluster
.
getClusterNodes
();
List
<
Map
<
String
,
Object
>>
ridMationList
=
new
ArrayList
<>();
Iterator
<
Map
.
Entry
<
String
,
JedisPool
>>
entries
=
jedisPools
.
entrySet
().
iterator
();
while
(
entries
.
hasNext
())
{
Entry
<
String
,
JedisPool
>
entry
=
entries
.
next
();
if
(
entry
.
getKey
().
indexOf
(
redisIp1
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp2
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp3
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp4
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp5
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp6
)
!=
-
1
){
jedis
=
entry
.
getValue
().
getResource
();
Client
client
=
jedis
.
getClient
();
client
.
info
();
String
info
=
client
.
getBulkReply
();
List
<
Map
<
String
,
Object
>>
ridList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
redisMation
=
new
HashMap
<>();
String
[]
strs
=
info
.
split
(
"\n"
);
Map
<
String
,
Object
>
bean
=
null
;
if
(
strs
!=
null
&&
strs
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
strs
.
length
;
i
++)
{
String
[]
str
=
strs
[
i
].
split
(
":"
);
if
(
str
!=
null
&&
str
.
length
>
1
)
{
bean
=
new
HashMap
<>();
bean
.
put
(
"key"
,
str
[
0
]);
bean
.
put
(
"value"
,
str
[
1
].
replace
(
"\n"
,
""
).
replace
(
"\r"
,
""
));
ridList
.
add
(
bean
);
}
}
redisMation
.
put
(
"ip"
,
entry
.
getKey
());
redisMation
.
put
(
"mation"
,
ridList
);
ridMationList
.
add
(
redisMation
);
}
}
}
return
JSONArray
.
fromObject
(
ridMationList
).
toString
();
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
List
<
Slowlog
>
getLogs
(
long
entries
)
{
Jedis
jedis
=
null
;
try
{
// jedis = jedisPool.getResource();
// List<Slowlog> logList = jedis.slowlogGet(entries);
return
null
;
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
Long
getLogsLen
()
{
Jedis
jedis
=
null
;
try
{
// jedis = jedisPool.getResource();
// long logLen = jedis.slowlogLen();
return
new
Long
(
10
);
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
String
logEmpty
()
{
Jedis
jedis
=
null
;
try
{
// jedis = jedisPool.getResource();
// return jedis.slowlogReset();
return
""
;
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
Long
dbSize
()
{
Jedis
jedis
=
null
;
try
{
// jedis = jedisPool.getResource();
// //配置redis服务信息
// Client client = jedis.getClient();
// client.dbSize();
// return client.getIntegerReply();
return
new
Long
(
10
);
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
getClusterNodes
()
throws
Exception
{
Map
<
String
,
JedisPool
>
jedisPools
=
jedisCluster
.
getClusterNodes
();
List
<
Map
<
String
,
Object
>>
ridPoolList
=
new
ArrayList
<>();
Iterator
<
Map
.
Entry
<
String
,
JedisPool
>>
entries
=
jedisPools
.
entrySet
().
iterator
();
while
(
entries
.
hasNext
())
{
Entry
<
String
,
JedisPool
>
entry
=
entries
.
next
();
if
(
entry
.
getKey
().
indexOf
(
redisIp1
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp2
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp3
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp4
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp5
)
!=
-
1
||
entry
.
getKey
().
indexOf
(
redisIp6
)
!=
-
1
){
Map
<
String
,
Object
>
redisPoolMation
=
new
HashMap
<>();
redisPoolMation
.
put
(
"ip"
,
entry
.
getKey
());
ridPoolList
.
add
(
redisPoolMation
);
}
}
return
ridPoolList
;
}
}
skyeye-service/src/main/java/com/skyeye/jedis/impl/JedisClientPool.java
浏览文件 @
a7fdd414
package
com.skyeye.jedis.impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.skyeye.jedis.JedisClient
;
import
redis.clients.jedis.Client
;
import
redis.clients.jedis.Jedis
;
import
redis.clients.jedis.JedisPool
;
import
redis.clients.util.SafeEncoder
;
import
redis.clients.util.Slowlog
;
/**
*
* @ClassName: JedisClientPool
* @Description: redis集群
* @author 卫志强
* @date 2018年11月17日
*
*/
public
class
JedisClientPool
implements
JedisClient
{
@Autowired
...
...
@@ -90,5 +104,73 @@ public class JedisClientPool implements JedisClient {
jedis
.
close
();
return
result
;
}
@Override
public
String
getRedisInfo
()
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
Client
client
=
jedis
.
getClient
();
client
.
info
();
String
info
=
client
.
getBulkReply
();
return
info
;
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
List
<
Slowlog
>
getLogs
(
long
entries
)
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
List
<
Slowlog
>
logList
=
jedis
.
slowlogGet
(
entries
);
return
logList
;
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
Long
getLogsLen
()
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
long
logLen
=
jedis
.
slowlogLen
();
return
logLen
;
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
String
logEmpty
()
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
return
jedis
.
slowlogReset
();
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
@Override
public
Long
dbSize
()
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
//配置redis服务信息
Client
client
=
jedis
.
getClient
();
client
.
dbSize
();
return
client
.
getIntegerReply
();
}
finally
{
// 返还到连接池
jedis
.
close
();
}
}
}
skyeye-web/src/main/java/com/skyeye/authority/controller/SysRedisMonitorController.java
0 → 100644
浏览文件 @
a7fdd414
package
com.skyeye.authority.controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.skyeye.authority.service.SysRedisMonitorService
;
import
com.skyeye.common.object.InputObject
;
import
com.skyeye.common.object.OutputObject
;
@Controller
public
class
SysRedisMonitorController
{
@Autowired
private
SysRedisMonitorService
sysRedisMonitorService
;
/**
*
* @Title: queryRedisInfoList
* @Description: 获取redis服务器信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping
(
"/post/SysRedisMonitorController/queryRedisInfoList"
)
@ResponseBody
public
void
queryRedisInfoList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
sysRedisMonitorService
.
queryRedisInfoList
(
inputObject
,
outputObject
);
}
/**
*
* @Title: queryRedisLogsList
* @Description: 获取redis日志信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping
(
"/post/SysRedisMonitorController/queryRedisLogsList"
)
@ResponseBody
public
void
queryRedisLogsList
(
InputObject
inputObject
,
OutputObject
outputObject
)
throws
Exception
{
sysRedisMonitorService
.
queryRedisLogsList
(
inputObject
,
outputObject
);
}
}
skyeye-web/src/main/resources/mapping/reqmapping.xml
浏览文件 @
a7fdd414
...
...
@@ -157,6 +157,11 @@
<property
id=
"limit"
name=
"limit"
ref=
"required,num"
var=
"分页参数,每页多少条数据"
/>
<property
id=
"page"
name=
"page"
ref=
"required,num"
var=
"分页参数,第几页"
/>
</url>
<url
id=
"redis001"
path=
"/post/SysRedisMonitorController/queryRedisInfoList"
val=
"获取redis服务器信息"
allUse=
"0"
>
</url>
<url
id=
"redis002"
path=
"/post/SysRedisMonitorController/queryRedisLogsList"
val=
"获取redis日志信息"
allUse=
"0"
>
</url>
<!-- 系统角色用户管理结束 -->
<!-- 系统数据库管理开始 -->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录