|  | @@ -125,7 +125,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |                  ssrcFactory.initMediaServerSSRC(mediaServer.getId(), null);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // 查询redis是否存在此mediaServer
 | 
	
		
			
				|  |  | -            String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServer.getId();
 | 
	
		
			
				|  |  | +            String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + mediaServer.getId();
 | 
	
		
			
				|  |  |              Boolean hasKey = redisTemplate.hasKey(key);
 | 
	
		
			
				|  |  |              if (hasKey != null && ! hasKey) {
 | 
	
		
			
				|  |  |                  redisTemplate.opsForValue().set(key, mediaServer);
 | 
	
	
		
			
				|  | @@ -261,7 +261,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |          if (mediaServerInRedis == null || !ssrcFactory.hasMediaServerSSRC(mediaServerInDataBase.getId())) {
 | 
	
		
			
				|  |  |              ssrcFactory.initMediaServerSSRC(mediaServerInDataBase.getId(),null);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerInDataBase.getId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + mediaServerInDataBase.getId();
 | 
	
		
			
				|  |  |          redisTemplate.opsForValue().set(key, mediaServerInDataBase);
 | 
	
		
			
				|  |  |          if (mediaServerInDataBase.isStatus()) {
 | 
	
		
			
				|  |  |              resetOnlineServerItem(mediaServerInDataBase);
 | 
	
	
		
			
				|  | @@ -277,8 +277,8 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<MediaServer> getAllOnlineList() {
 | 
	
		
			
				|  |  |          List<MediaServer> result = new ArrayList<>();
 | 
	
		
			
				|  |  | -        List<Object> mediaServerKeys = RedisUtil.scan(redisTemplate, String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" ));
 | 
	
		
			
				|  |  | -        String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        List<Object> mediaServerKeys = RedisUtil.scan(redisTemplate, String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + ":" ));
 | 
	
		
			
				|  |  | +        String onlineKey = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          for (Object mediaServerKey : mediaServerKeys) {
 | 
	
		
			
				|  |  |              String key = (String) mediaServerKey;
 | 
	
		
			
				|  |  |              MediaServer mediaServer = JsonUtil.redisJsonToObject(redisTemplate, key, MediaServer.class);
 | 
	
	
		
			
				|  | @@ -326,14 +326,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<MediaServer> getAllOnline() {
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          Set<Object> mediaServerIdSet = redisTemplate.opsForZSet().reverseRange(key, 0, -1);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<MediaServer> result = new ArrayList<>();
 | 
	
		
			
				|  |  |          if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) {
 | 
	
		
			
				|  |  |              for (Object mediaServerId : mediaServerIdSet) {
 | 
	
		
			
				|  |  |                  String mediaServerIdStr = (String) mediaServerId;
 | 
	
		
			
				|  |  | -                String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerIdStr;
 | 
	
		
			
				|  |  | +                String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + mediaServerIdStr;
 | 
	
		
			
				|  |  |                  result.add((MediaServer) redisTemplate.opsForValue().get(serverKey));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -351,7 +351,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |          if (mediaServerId == null) {
 | 
	
		
			
				|  |  |              return null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId;
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + mediaServerId;
 | 
	
		
			
				|  |  |          return JsonUtil.redisJsonToObject(redisTemplate, key, MediaServer.class);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -363,7 +363,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void clearMediaServerForOnline() {
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          redisTemplate.delete(key);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -401,7 +401,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void resetOnlineServerItem(MediaServer serverItem) {
 | 
	
		
			
				|  |  |          // 更新缓存
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          // 使用zset的分数作为当前并发量, 默认值设置为0
 | 
	
		
			
				|  |  |          if (redisTemplate.opsForZSet().score(key, serverItem.getId()) == null) {  // 不存在则设置默认值 已存在则重置
 | 
	
		
			
				|  |  |              redisTemplate.opsForZSet().add(key, serverItem.getId(), 0L);
 | 
	
	
		
			
				|  | @@ -424,14 +424,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |          if (mediaServerId == null) {
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          redisTemplate.opsForZSet().incrementScore(key, mediaServerId, 1);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void removeCount(String mediaServerId) {
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          redisTemplate.opsForZSet().incrementScore(key, mediaServerId, - 1);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -441,7 +441,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public MediaServer getMediaServerForMinimumLoad(Boolean hasAssist) {
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId();
 | 
	
		
			
				|  |  |          Long size = redisTemplate.opsForZSet().zCard(key);
 | 
	
		
			
				|  |  |          if (size  == null || size == 0) {
 | 
	
		
			
				|  |  |              logger.info("获取负载最低的节点时无在线节点");
 | 
	
	
		
			
				|  | @@ -520,8 +520,8 @@ public class MediaServerServiceImpl implements IMediaServerService {
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void delete(String id) {
 | 
	
		
			
				|  |  |          mediaServerMapper.delOne(id);
 | 
	
		
			
				|  |  | -        redisTemplate.opsForZSet().remove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id);
 | 
	
		
			
				|  |  | -        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id;
 | 
	
		
			
				|  |  | +        redisTemplate.opsForZSet().remove(VideoManagerConstants.ONLINE_MEDIA_SERVERS_PREFIX + userSetting.getServerId(), id);
 | 
	
		
			
				|  |  | +        String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + id;
 | 
	
		
			
				|  |  |          redisTemplate.delete(key);
 | 
	
		
			
				|  |  |          // 发送节点移除通知
 | 
	
		
			
				|  |  |          MediaServerDeleteEvent event = new MediaServerDeleteEvent(this);
 |