New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improves docs on Cassandra setup #703
Improves docs on Cassandra setup #703
Conversation
ignasi35
commented
Apr 28, 2017
- specify settings are for devmode only
- document how to setup a static list of contact-points
@@ -156,4 +156,25 @@ In sbt: | |||
|
|||
@[local-instance](code/build-cassandra-opts3.sbt) | |||
|
|||
Assuming your local Cassandra instance is running on port `9042`. | |||
These two settings will only be used when running Lagom in DevMode. The purpose of these two settings is to disabled the embedded Cassandra server and configure the Service Locator in DevMode to still be able to locate Cassandra when looking for `cas_native`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/disabled/disable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it should say why you would disable the embedded Cassandra - typically, you would do this if you were already running your own Cassandra locally, perhaps you have another application not managed by Lagom that uses Cassandra, and for running that you run Cassandra, and it doesn't make sense for Lagom to start its own Cassandra then.
|
||
The service locator setup in these examples assumes your local Cassandra instance is running on port `9042`. | ||
|
||
## Disabling Service Location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this section really belongs in the page on the development mode Cassandra server. Maybe it should be on the page about configuring Cassandra persistent entities?
Despite that, there scenarios where a hard-coded list of contact-points is required and updating and maintaining a list of endpoints in a service locator is not a viable option. In that case a user may use the following setup in the `application.conf` of your service: | ||
|
||
``` | ||
cassandra { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this need to be configured separately for cassandra-journal
, cassandra-snapshot-store
and lagom.persistence.read-side.cassandra
? AFAIK nothing reads this config out of the cassandra
namespace (although maybe it would be more convenient if we had a shared default key substituted in to the three namespaces).
|
||
It is possible to hardcode the list of `contact-points` where Cassandra may be located. That is the default behavior in `akka-persistence-cassandra` but Lagom overrides that behavior implementing a Session provider based on service location. That allows all services to continue to operate without the need to redeploy if/when the Cassandra `contact-points` are updated or fail. Using a Service Location based approach provides higher resiliency. | ||
|
||
Despite that, there scenarios where a hard-coded list of contact-points is required and updating and maintaining a list of endpoints in a service locator is not a viable option. In that case a user may use the following setup in the `application.conf` of your service: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: "s/there scenarios/there are scenarios"
I ended up using a different approach. I like @TimMoore's suggestion to remove the info from the dev-mode section and placed the docs I was adding in the ProductionOverview page. This way a developer adding cassandra support will first read C* PE and configure the minimum to make it work. At the end of that page I linked |
|
||
Lagom will start an embedded Cassandra server when running in developer mode. You can review the configuration options or how to disable the embedded server in the section on Cassandra Server in [[Running Lagom in development|CassandraServer]]. | ||
|
||
In production you usually will prefer a dinamically locatable Cassandra server for resiliency. If you need to use a static list of contact-points to locate your Cassandra server review the section on deploying using static service location for Cassandra Service in [[Running Lagom in Production|ProductionOverview#Deploying-using-static-Cassandra-contact-points]]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo: dinamically -> dynamically (I'll go ahead and fix it myself)
This setup disables Lagom's `ConfigSessionProvider` and fallbacks to that provided in `akka-persistence-cassandra` which uses the list of endpoints listed in `contact-points`. | ||
|
||
This configuration is part of `application.conf` and therefore it will be applied in all environments (develpment and production) unless overriden. See developer mode settings on [[overriding Cassandra setup in Dev Mode|CassandraServer#Connecting-to-a-locally-running-Cassandra-instance]] for more information on settings up Cassandra in dev mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another typo: develpment -> development
session-provider = akka.persistence.cassandra.ConfigSessionProvider | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still missing the three different namespace prefixes.
This uses substitution to avoid redefining the values in multiple places.
I went ahead and pushed some minor changes to your branch. I'm OK to merge if you are, but if you don't like something about the way I changed it, feel free to keep working on it. |
Thanks @TimMoore |
* Documents the override for static list of endpoints * Don't use same verb twice * Moved the info to Production section and added cross link on PE pages * Fix typos * Correct the Cassandra configuration key prefixes This uses substitution to avoid redefining the values in multiple places.
Backported to |