redis.clients.jedis.Jedis.slaveof()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中redis.clients.jedis.Jedis.slaveof()方法的一些代码示例,展示了Jedis.slaveof()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.slaveof()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:slaveof

Jedis.slaveof介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public void slaveOf(String host, int port) {
  Assert.hasText(host, "Host must not be null for 'SLAVEOF' command.");
  if (isQueueing() || isPipelined()) {
    throw new UnsupportedOperationException("'SLAVEOF' cannot be called in pipline / transaction mode.");
  }
  try {
    this.connection.getJedis().slaveof(host, port);
  } catch (Exception e) {
    throw convertJedisAccessException(e);
  }
}

代码示例来源:origin: mindwind/craft-atom

private String slaveof0(Jedis j, String host, int port) {
  return j.slaveof(host, port);
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public String slaveof(String host, int port) {
  return master.slaveof(host, port);
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public String slaveof(String host, int port) {
 String command = "slaveof";
 return instrumented(command, () -> delegated.slaveof(host, port));
}

代码示例来源:origin: io.enoa/nosql-redis

default String slaveof(final String host, final int port) {
 return this.run((jedis, serializer) -> jedis.slaveof(host, port));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public void slaveOf(String host, int port) {
  Assert.hasText(host, "Host must not be null for 'SLAVEOF' command.");
  if (isQueueing() || isPipelined()) {
    throw new UnsupportedOperationException("'SLAVEOF' cannot be called in pipline / transaction mode.");
  }
  try {
    this.connection.getJedis().slaveof(host, port);
  } catch (Exception e) {
    throw convertJedisAccessException(e);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public void slaveOf(String host, int port) {
  Assert.hasText(host, "Host must not be null for 'SLAVEOF' command.");
  if (isQueueing() || isPipelined()) {
    throw new UnsupportedOperationException("'SLAVEOF' cannot be called in pipline / transaction mode.");
  }
  try {
    this.connection.getJedis().slaveof(host, port);
  } catch (Exception e) {
    throw convertJedisAccessException(e);
  }
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

/**
 * Change the replication settings.
 * <p>
 * The SLAVEOF command can change the replication settings of a slave on the fly. If a Redis
 * server is arleady acting as slave, the command SLAVEOF NO ONE will turn off the replicaiton
 * turning the Redis server into a MASTER. In the proper form SLAVEOF hostname port will make the
 * server a slave of the specific server listening at the specified hostname and port.
 * <p>
 * If a server is already a slave of some master, SLAVEOF hostname port will stop the replication
 * against the old server and start the synchrnonization against the new one discarding the old
 * dataset.
 * <p>
 * The form SLAVEOF no one will stop replication turning the server into a MASTER but will not
 * discard the replication. So if the old master stop working it is possible to turn the slave
 * into a master and set the application to use the new master in read/write. Later when the other
 * Redis server will be fixed it can be configured in order to work as slave.
 * <p>
 *
 * @param host
 * @param port
 * @return Status code reply
 */
public String slaveof(String host, int port) {
  Jedis jedis = getJedis();
  try {
    return jedis.slaveof(host, port);
  } finally {Streams.safeClose(jedis);}
}

相关文章

微信公众号

最新文章

更多

Jedis类方法