Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:24:35+00:00 2026-06-14T18:24:35+00:00

I’m trying to configure a master/slave replication on Cloudfoundry but I always fall with

  • 0

I’m trying to configure a master/slave replication on Cloudfoundry but I always fall with a ‘ERR unknown command ‘SLAVEOF”. I’m using Jedis as the underlying client of spring-data-reids with this code:

@Configuration
@ComponentScan(basePackages = { Constants.REDIS_PACKAGE })
@Order(1)
public class KeyValueConfig {

    @Inject
    @Named("redisMasterConnectionFactory")
    private RedisConnectionFactory redisMasterConnectionFactory;

    @Inject
    @Named("redisSlaveConnectionFactory")
    private RedisConnectionFactory redisSlaveConnectionFactory;

    @Inject
    @Named("redisCacheConnectionFactory")
    private RedisConnectionFactory redisCacheConnectionFactory;

    @Bean
    public StringRedisTemplate redisMasterTemplate() {
        StringRedisTemplate stringRedisTemplate = new StringRedisTemplate(
                redisMasterConnectionFactory);
        HealthChecks.register(new RedisHealthCheck(stringRedisTemplate,
                "master"));
        return stringRedisTemplate;
    }

    @Bean
    public StringRedisTemplate redisSlaveTemplate() {
        StringRedisTemplate stringRedisTemplate = new StringRedisTemplate(
                redisSlaveConnectionFactory);
        HealthChecks
                .register(new RedisHealthCheck(stringRedisTemplate, "slave"));
        return stringRedisTemplate;
    }

    @Bean
    public StringRedisTemplate redisCacheTemplate() {
        StringRedisTemplate stringRedisTemplate = new StringRedisTemplate(
                redisCacheConnectionFactory);
        HealthChecks
                .register(new RedisHealthCheck(stringRedisTemplate, "cache"));
        return stringRedisTemplate;
    }

    /**
     * Properties to support the local and test mode of operation.
     */
    @Configuration
    @Profile({ Profiles.LOCAL, Profiles.PROD, Profiles.TEST })
    static class Default implements MasterSlaveConfig {

        @Inject
        private Environment environment;

        @Bean
        public RedisConnectionFactory redisMasterConnectionFactory() {
            JedisConnectionFactory redis = new JedisConnectionFactory();
            redis.setHostName(environment.getProperty("redis.master.hostname"));
            redis.setPort(environment.getProperty("redis.master.port",
                    Integer.class));
            redis.setPassword(environment.getProperty("redis.master.password"));
            redis.setUsePool(true);
            return redis;
        }

        @Bean
        public RedisConnectionFactory redisSlaveConnectionFactory() {
            JedisConnectionFactory redis = new JedisConnectionFactory();
            redis.setHostName(environment.getProperty("redis.slave.hostname"));
            redis.setPort(environment.getProperty("redis.slave.port",
                    Integer.class));
            redis.setPassword(environment.getProperty("redis.slave.password"));
            redis.setUsePool(true);
            return redis;
        }

        @Bean
        public RedisConnectionFactory redisCacheConnectionFactory()
                throws Exception {
            JedisConnectionFactory redis = new JedisConnectionFactory();
            redis.setHostName(environment.getProperty("redis.cache.hostname"));
            redis.setPort(environment.getProperty("redis.cache.port",
                    Integer.class));
            redis.setPassword(environment.getProperty("redis.cache.password"));
            redis.setUsePool(true);
            return redis;
        }
    }

    /**
     * Properties to support the cloud mode of operation.
     */
    @Configuration
    @Profile(Profiles.CLOUDFOUNDRY)
    static class Cloud implements MasterSlaveConfig {

        @Bean
        public RedisConnectionFactory redisMasterConnectionFactory()
                throws Exception {
            CloudPoolConfiguration cloudPoolConfiguration = new CloudPoolConfiguration();
            cloudPoolConfiguration.setPoolSize("3-5");

            CloudRedisConnectionFactoryBean factory = new CloudRedisConnectionFactoryBean();
            factory.setCloudPoolConfiguration(cloudPoolConfiguration);
            factory.setServiceName("redis-master");
            factory.afterPropertiesSet();

            return factory.getObject();
        }

        @Bean
        public RedisConnectionFactory redisSlaveConnectionFactory()
                throws Exception {
            CloudPoolConfiguration cloudPoolConfiguration = new CloudPoolConfiguration();
            cloudPoolConfiguration.setPoolSize("3-5");

            CloudRedisConnectionFactoryBean factory = new CloudRedisConnectionFactoryBean();
            factory.setCloudPoolConfiguration(cloudPoolConfiguration);
            factory.setServiceName("redis-slave");
            factory.afterPropertiesSet();

            RedisConnectionFactory redisSlaveConnectionFactory = initSlaveOnMaster(factory);

            return redisSlaveConnectionFactory;
        }

        private RedisConnectionFactory initSlaveOnMaster(
                CloudRedisConnectionFactoryBean factory) throws Exception {
            RedisConnectionFactory redisSlaveConnectionFactory = factory
                    .getObject();

            RedisServiceInfo serviceInfo = new CloudEnvironment()
                    .getServiceInfo("redis-master", RedisServiceInfo.class);

            Jedis jedis = (Jedis) redisSlaveConnectionFactory.getConnection()
                    .getNativeConnection();
            jedis.slaveof(serviceInfo.getHost(), serviceInfo.getPort());
            return redisSlaveConnectionFactory;
        }

        @Bean
        public RedisConnectionFactory redisCacheConnectionFactory()
                throws Exception {
            CloudPoolConfiguration cloudPoolConfiguration = new CloudPoolConfiguration();
            cloudPoolConfiguration.setPoolSize("3-5");

            CloudRedisConnectionFactoryBean factory = new CloudRedisConnectionFactoryBean();
            factory.setCloudPoolConfiguration(cloudPoolConfiguration);
            factory.setServiceName("redis-cache");
            factory.afterPropertiesSet();

            return factory.getObject();
        }
    }

    interface MasterSlaveConfig {

        RedisConnectionFactory redisMasterConnectionFactory() throws Exception;

        RedisConnectionFactory redisSlaveConnectionFactory() throws Exception;

        RedisConnectionFactory redisCacheConnectionFactory() throws Exception;
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:24:36+00:00Added an answer on June 14, 2026 at 6:24 pm

    Ok… After checking the code, I found this:

    rename-command SLAVEOF “” in redis.conf.erb (https://github.com/cloudfoundry/vcap-services/blob/master/redis/resources/redis.conf.erb)

    So the SLAVEOF command is disable on Cloudfoudry, and so:

    • MONITOR
    • BGSAVE
    • BGREWRITEAOF
    • SLAVEOF
    • DEBUG
    • SYNC
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.