小编Bik*_*wal的帖子

Jedis,无法获得jedis连接:无法从池中获取资源

我已经看到几个线程中的答案,但没有为我工作,因为偶尔会出现问题,如果有任何人有任何想法,请问这个问题.

我使用的是jedis版本2.8.0,Spring Data redis版本1.7.5.和我们的缓存应用程序的redis服务器版本2.8.4.

我有多个缓存,用redis保存,get请求是从redis完成的.我使用spring数据redis API来保存和获取数据.

所有保存和获取工作正常,但偶尔低于例外:

Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool | org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the poolorg.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:198)
org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:345)
org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:129)
org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:92)
org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:79)
org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191)
org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:166)
org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:88)
org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:49)
Run Code Online (Sandbox Code Playgroud)

我的redis配置类:

@Configuration
public class RedisConfiguration {

@Value("${redisCentralCachingURL}")
private String redisHost;

@Value("${redisCentralCachingPort}")
private int redisPort; …
Run Code Online (Sandbox Code Playgroud)

spring redis jedis spring-data-redis

9
推荐指数
2
解决办法
2万
查看次数

Cassandra Java Driver 将字段名称转换为小写

我正在使用 cassandra-driver-core 版本 3.5.1

我在卡桑德拉有一张桌子。表中的所有字段都是驼峰式大小写并用双引号创建。这些字段需要采用驼峰式大小写,因为我的 solr 架构有驼峰式大小写,我们有大约 80-120 字段。

但是当我在这个表中插入我的 json 文档时,使用下面的代码:

//jsonData is json document in String 
Insert insertQuery = QueryBuilder.insertInto(keySpace, table).json(jsonData);
ResultSet resultSet = session.execute(insertQuery.toString());
Run Code Online (Sandbox Code Playgroud)

生成的插入查询:

INSERT INTO asda_search.GROCERIES JSON '{"catalogName":"some data", .....);
Run Code Online (Sandbox Code Playgroud)

cassandra 驱动程序将插入语句中的字段转换为小写,导致以下异常:

Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: JSON values map contains unrecognized column: catalogname
Run Code Online (Sandbox Code Playgroud)

在我的表字段名称是 catalogName

我应该怎么做,以便驱动程序不会小写我的字段?

更新:

我知道我可以创建查询如下:

QueryBuilder.insertInto(keySpace, table).values(fieldNameList, fieldValueList)
Run Code Online (Sandbox Code Playgroud)

在创建时,fieldNameList我可以为字段名称添加引号。

还有其他解决办法吗?

java cassandra-3.0 cassandra-driver

5
推荐指数
1
解决办法
399
查看次数

Java 8 streams, convert List of object to Map<String, Set<String>>

I have already gone through few examples and those did not work for me.

Here is what I am trying to do:

I have a List<SomeClass> of the following class:

class SomeClass {
  String rid;
  String name;
  ...
}
Run Code Online (Sandbox Code Playgroud)

The values in my List look like this:

SomeClass(1,"apple")
SomeClass(1,"banana")
SomeClass(1,"orange")
SomeClass(2,"papaya")
SomeClass(2,"peaches")
SomeClass(3,"melons")
Run Code Online (Sandbox Code Playgroud)

I want to convert the above List into a Map<String, Set<String>>, where key is rid and value is Set of name field.

To solve this using …

java java-8 java-stream

3
推荐指数
1
解决办法
1336
查看次数

卡桑德拉截断表现

我最近被告知,cassandra truncate不是高效的,而且是反模式.但是,我不知道为什么?

所以,我有两个问题:

  • 拥有所有记录然后进行截断是否更高效?

  • 截断操作是否会创建墓碑?

卡桑德拉版本:3.x

truncate cassandra

2
推荐指数
1
解决办法
278
查看次数