您好,登錄后才能下訂單哦!
本篇文章為大家展示了iBash4J部署時(shí)啟動(dòng)項(xiàng)目連接不上Redis無法從JedisPool中獲取連接該怎么辦,內(nèi)容簡明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
以下是配置文件
redis.host=192.168.158.128redis.port=6379redis.password=#最小空閑數(shù)redis.minIdle=2#最大空閑數(shù)redis.maxIdle=10#最大連接數(shù)redis.maxTotal=100#最大建立連接等待時(shí)間 redis.maxWaitMillis=8000#客戶端超時(shí)時(shí)間單位是毫秒redis.timeout=120000#明是否在從池中取出連接前進(jìn)行檢驗(yàn),如果檢驗(yàn)失敗,則從池中去除連接并嘗試取出另一個(gè)redis.testOnBorrow=trueredis.expiration=600#redisclusterspring.redis.cluster.nodes=192.168.158.128:7001,192.168.158.128:7002,192.168.158.128:7003,192.168.158.128:7004,192.168.158.128:7005,192.168.158.128:7006spring.redis.cluster.max-redirects=3#rediscluster
<?xml version="1.0" encoding="UTF-8"?><beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <!-- jedis 配置--> <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig" ><!--最小空閑數(shù)--> <property name="minIdle" value="${redis.minIdle}" /><!--最大空閑數(shù)--> <property name="maxIdle" value="${redis.maxIdle}" /><!--最大連接數(shù)--> <property name="maxTotal" value="${redis.maxTotal}" /><!--最大建立連接等待時(shí)間--> <property name="maxWaitMillis" value="${redis.maxWaitMillis}" /><!--是否在從池中取出連接前進(jìn)行檢驗(yàn),如果檢驗(yàn)失敗,則從池中去除連接并嘗試取出另一個(gè)--> <property name="testOnBorrow" value="${redis.testOnBorrow}" /> </bean > <bean id="jedisShardInfo" class="org.ibase4j.core.support.cache.jedis.JedisShardInfo"> <constructor-arg index="0" value="${redis.host}" /> <constructor-arg index="1" value="${redis.port}" type="int" /> <property name="password" value="${redis.password}" /> </bean> <!-- redisCluster配置 --> <!-- <bean id="redisClusterConfiguration" class="org.springframework.data.redis.connection.RedisClusterConfiguration"> <constructor-arg name="propertySource"> <bean id="resourcePropertySource" class="org.springframework.core.io.support.ResourcePropertySource"> <constructor-arg name="name" value="redis.properties"/> <constructor-arg name="resource" value="classpath:config/system.properties"/> </bean> </constructor-arg> </bean> --> <!-- redis服務(wù)器中心 --> <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:pool-config-ref="jedisPoolConfig" p:shard-info-ref="jedisShardInfo" p:timeout="${redis.timeout}" /><!-- 緩存序列化方式 --> <bean id="keySerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer" /> <bean id="valueSerializer" class="org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer" /><!-- 緩存 --> <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"> <property name="connectionFactory" ref="jedisConnectionFactory" /> <property name="keySerializer" ref="keySerializer" /> <property name="valueSerializer" ref="valueSerializer" /> <property name="hashKeySerializer" ref="keySerializer" /> <property name="hashValueSerializer" ref="valueSerializer" /> </bean> <bean id="redisCacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"> <constructor-arg index="0" ref="redisTemplate" /> <property name="defaultExpiration" value="10" /> </bean></beans>
上述內(nèi)容就是iBash4J部署時(shí)啟動(dòng)項(xiàng)目連接不上Redis無法從JedisPool中獲取連接該怎么辦,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。