Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

[SCB-1532] Redis configuration is invalid#576

Merged
WillemJiang merged 1 commit intoapache:masterfrom
Fxdemon:patch-1
Oct 22, 2019
Merged

[SCB-1532] Redis configuration is invalid#576
WillemJiang merged 1 commit intoapache:masterfrom
Fxdemon:patch-1

Conversation

@Fxdemon
Copy link
Copy Markdown
Contributor

@Fxdemon Fxdemon commented Oct 18, 2019

#redis 单机模式
#akkaConfig:
#  akka.persistence.journal.plugin: akka-persistence-redis.journal
#  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
#  akka-persistence-redis:
#    redis:
#      mode: simple
#      host: ${spring.redis.host}
#      port: ${spring.redis.port}
#      database: 0
#      #password: ${spring.redis.password}

#redis 哨兵模式
akkaConfig:
  akka.persistence.journal.plugin: akka-persistence-redis.journal
  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
  akka-persistence-redis:
    redis:
      mode: sentinel
      database: 1
      password: ${spring.redis.password}
      master: ${spring.redis.sentinel.master}
  sentinel-list: ${spring.redis.sentinel.nodes}

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

#redis 单机模式
#akkaConfig:
#  akka.persistence.journal.plugin: akka-persistence-redis.journal
#  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
#  akka-persistence-redis:
#    redis:
#      mode: simple
#      host: ${spring.redis.host}
#      port: ${spring.redis.port}
#      database: 0
#      #password: ${spring.redis.password}

#redis 哨兵模式
akkaConfig:
  akka.persistence.journal.plugin: akka-persistence-redis.journal
  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
  akka-persistence-redis:
    redis:
      mode: sentinel
      database: 1
      password: ${spring.redis.password}
      master: ${spring.redis.sentinel.master}
      sentinel-list: ${spring.redis.sentinel.nodes}
@coolbeevip
Copy link
Copy Markdown
Member

直接在 application.yaml 中增加配置不行吗?

@Fxdemon
Copy link
Copy Markdown
Contributor Author

Fxdemon commented Oct 18, 2019

不行

@coolbeevip
Copy link
Copy Markdown
Member

我们希望对于redis的支持可以通过启动参数配置,而不是通过重新编译源代码的方式,按照你修改后的解析方式,我理解应该就支持以下这种方式了,你能确认一下吗?

redis 单例模式

--akkaConfig.akka-persistence-redis.redis.mode=simple
--akkaConfig.akka-persistence-redis.redis.host=127.0.0.1
--akkaConfig.akka-persistence-redis.redis.port=6379
--akkaConfig.akka-persistence-redis.redis.database=0
--akkaConfig.akka-persistence-redis.redis.password=xxx

redis 哨兵模式

--akkaConfig.akka-persistence-redis.redis.mode=sentinel
--akkaConfig.akka-persistence-redis.redis.host=127.0.0.1
--akkaConfig.akka-persistence-redis.redis.port=6379
--akkaConfig.akka-persistence-redis.redis.database=0
--akkaConfig.akka-persistence-redis.redis.master=mymaster
--akkaConfig.akka-persistence-redis.redis.sentinel-list=127.0.0.1:6379
--akkaConfig.akka-persistence-redis.redis.password=xxx

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.1%) to 80.659% when pulling a300e45 on Fxdemon:patch-1 into 5c45d80 on apache:master.

@coolbeevip coolbeevip changed the title akka resdis persistence [SCB-1532] Redis configuration is invalid Oct 19, 2019
Copy link
Copy Markdown
Member

@WillemJiang WillemJiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update the document for it?


if(name.startsWith(REDIS_NAME) && !propertyMap.containsKey(name)){
String readJournalKey = ("akka-persistence-redis.read-journal.redis.").concat(name.substring(REDIS_NAME.length()));
String journalKey = ("akka-persistence-redis.journal.redis.").concat(name.substring(REDIS_NAME.length()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to set up 3 configuration key with one value?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to set up 3 configuration key with one value?
It's OK, akka-persistence-redis contain three components, journal, snapshot, read-journal, their Redis configuration is the same.

https://github.com/safety-data/akka-persistence-redis/blob/master/src/main/resources/reference.conf

@Fxdemon
Copy link
Copy Markdown
Contributor Author

Fxdemon commented Oct 22, 2019

--akkaConfig.akka-persistence-redis.redis.mode=sentinel
--akkaConfig.akka-persistence-redis.redis.database=0
--akkaConfig.akka-persistence-redis.redis.master=mymaster
--akkaConfig.akka-persistence-redis.redis.sentinel-list=127.0.0.1:6379
--akkaConfig.akka-persistence-redis.redis.password=xxx
如上配akka-persistence-redis.jar 读取不到对应配置信息, 目前默认读取akka-persistence-redis.jar中 *.conf中的配置

使用方式:

#redis 单机模式
#akkaConfig:
#  akka.persistence.journal.plugin: akka-persistence-redis.journal
#  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
#  akka-persistence-redis:
#    redis:
#      mode: simple
#      host: ${spring.redis.host}
#      port: ${spring.redis.port}
#      database: 0
#      #password: ${spring.redis.password}

#redis 哨兵模式
`akkaConfig:
  akka.persistence.journal.plugin: akka-persistence-redis.journal
  akka.persistence.snapshot-store.plugin: akka-persistence-redis.snapshot
  akka-persistence-redis:
    redis:
      mode: sentinel
      database: 1
      password: ${spring.redis.password}
      master: ${spring.redis.sentinel.master}
      sentinel-list: ${spring.redis.sentinel.nodes}`

@Fxdemon Fxdemon requested a review from WillemJiang October 22, 2019 03:16
Copy link
Copy Markdown
Member

@coolbeevip coolbeevip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update fsm_manual_zh.md later.

@WillemJiang WillemJiang merged commit c6ff0d1 into apache:master Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants