Skip to content
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

Add advanced replica set configuration #478

Merged

Conversation

DeathBorn
Copy link
Contributor

@DeathBorn DeathBorn commented Aug 1, 2018

Add advanced replica set configuration

  • backwards compatible
  • custom rs.config()["settings"] hash can be provided
  • rs.config()["members"] replset members can be either an array of host strings like before or hashes to have custom configuration

Examples

{
  "replset_config": {
    "rs_given_name": {
      "ensure": "present",
      "settings":{
        "heartbeatTimeoutSecs": 15,
        "getLastErrorModes": {
          "SomeUserCase" : { 
            "dc": 1, 
            "use": 1
          }
        }
      },
      "members": [
        {
          "host": "host1:27017",
          "tags": { "dc" : "east", "use" : "readLoad"},
          "hidden": false
        },
        {
          "host": "host2:27017",
          "tags": { "dc" : "west" }
        },
        {
          "host": "host2:27017",
          "tags": { "dc" : "east"}
        }
      ]
    }
  }
}

or

{
  "replset_config": {
    "rs_given_name": {
      "ensure": "present",
      "settings":{},
      "members": [
        "host1:27017",
        "host2:27017",
        "host2:27017"
      ]
    }
  }
}

@DeathBorn DeathBorn force-pushed the advanced_replset_configuration branch 4 times, most recently from 7c68601 to a3ed9e0 Compare August 2, 2018 10:24
@DeathBorn DeathBorn force-pushed the advanced_replset_configuration branch from 5eb8eef to 4f862f2 Compare August 2, 2018 11:33
@DeathBorn
Copy link
Contributor Author

arbiter configuration is made through member, not through arbiter parameter.

@ralcini
Copy link

ralcini commented Aug 15, 2018

@DeathBorn great! This pull request can handle all the point of #102 ...

@DeathBorn
Copy link
Contributor Author

it is running on production :)

@@ -427,7 +427,7 @@ Mutually exclusive with `replset_members` param.
```puppet
class mongodb::server {
replset => 'rsmain',
replset_config => { 'rsmain' => { ensure => present, members => ['host1:27017', 'host2:27017', 'host3:27017'] } }
replset_config => { 'rsmain' => { ensure => present, settings => { heartbeatTimeoutSecs => 15, getLastErrorModes => { ttmode => { dc => 1 } } }, members => [{'host'=>'host1:27017', 'tags':{ 'dc' : 'east'}}, { 'host' => 'host2:27017'}, 'host3:27017'] } }
Copy link
Member

Choose a reason for hiding this comment

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

The change here to the members array is a breaking change, right? If I see this correctly, the old syntax isn't working anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it is backwards compatible.

['host1:27017', 'host2:27017', 'host3:27017']

would work as well as

[{'host'=>'host1:27017'},'host2:27017', 'host3:27017']

or

[{'host'=>'host1:27017', 'tags':{ 'dc' : 'east'}}, { 'host' => 'host2:27017'}, { 'host' => 'host3:27017'}]

because internally, this is converted to an array of hashes

@bastelfreak bastelfreak added enhancement New feature or request backwards-incompatible needs-feedback Further information is requested labels Aug 19, 2018
@bastelfreak
Copy link
Member

Thanks!

@bastelfreak bastelfreak removed backwards-incompatible needs-feedback Further information is requested labels Aug 19, 2018
@bastelfreak bastelfreak changed the title Advanced replset configuration Add advanced replica set configuration Aug 19, 2018
@bastelfreak bastelfreak merged commit 3f16ab4 into voxpupuli:master Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants