开启哨兵模式

修改beans.xml

  • 注释单机redis,开启哨兵配置

<!--哨兵模式开启-->
<bean id="jedisSentinelPool" class="redis.clients.jedis.JedisSentinelPool">
        <constructor-arg index="0" value="${redis.mastername}"/>
        <constructor-arg index="1">
            <set>
                <value>${redis.issentinel.host1}:${redis.sentinel.port1}</value>
                <value>${redis.issentinel.host2}:${redis.sentinel.port2}</value>
                <value>${redis.issentinel.host3}:${redis.sentinel.port3}</value>
            </set>
        </constructor-arg>
        <constructor-arg index="2" ref="jedisPoolConfig"/>
        <constructor-arg index="3" value="${redis.pass}"/>
    </bean>

    <bean id="sentinelConfig" class="org.springframework.data.redis.connection.RedisSentinelConfiguration">
        <!-- 服务名称 -->
        <property name="master">
            <bean class="org.springframework.data.redis.connection.RedisNode">
                <property name="name" value="${redis.mastername}"/>
            </bean>
        </property>

        <!-- 哨兵服务IP与端口 -->
        <property name="sentinels">
            <set>
                <!-- 哨兵1 -->
                <bean class="org.springframework.data.redis.connection.RedisNode">
                    <constructor-arg name="host" value="${redis.issentinel.host1}"/>
                    <constructor-arg name="port" value="${redis.sentinel.port1}"/>
                </bean>

                <!-- 哨兵2 -->
                <bean class="org.springframework.data.redis.connection.RedisNode">
                    <constructor-arg name="host" value="${redis.issentinel.host2}"/>
                    <constructor-arg name="port" value="${redis.sentinel.port2}"/>
                </bean>

                <!-- 哨兵3 -->
                <bean class="org.springframework.data.redis.connection.RedisNode">
                    <constructor-arg name="host" value="${redis.issentinel.host3}"/>
                    <constructor-arg name="port" value="${redis.sentinel.port3}"/>
                </bean>
            </set>
        </property>
    </bean>

    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
          destroy-method="destroy">
        <property name="password" value="${redis.pass}"/>
        <constructor-arg name="sentinelConfig" ref="sentinelConfig"/>
        <property name="database" value="${redis.dbindex}"/>
        <property name="timeout" value="3000"/>
        <property name="poolConfig" ref="jedisPoolConfig"/>
    </bean>
<!--哨兵模式结束-->
  • 配置reids文件地址

文档

使用mongodb存储

  • 添加配置文件

    # mongos端口
    mongodb.port=27088
    # mongos地址
    mongodb.host=192.168.20.5
    # mongos用户名
    mongodb.username=jepaasadmin
    # mongos密码
    mongodb.password=123456
    # mongos库名字
    mongodb.databasename=jepaas

  • 引入

  • 添加bucket
    insert语句,需要把之前默认的改成0,mysql插入语句

INSERT INTO `jepaas`.`je_document_bucket`(`id`, `bucket`, `save_type`, `permission`, `access_bucket`, `access_key`, `secret_key`, `base_path`, `url`, `is_default_bucket`, `version`, `create_user`, `create_time`, `modified_user`, `modified_time`, `is_deleted`, `EXT1`, `EXT2`, `EXT3`) VALUES (4, 'mongodb', 'mongodb', 'public-read', '', '', '', 'hashed', '', 1, 1, 'system', '2019-09-02 14:34:04', 'system', '2019-09-02 14:34:04', 0, NULL, NULL, NULL);

最后编辑: 呼丽华  文档更新时间: 2024-08-21 10:58   作者:呼丽华