Sharding is broken. Here are some fixes.

Bug #1839666 reported by Charles Clark
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MongoDB Charm
Won't Fix
Medium
Edin S

Bug Description

Hi everyone,

There are a couple problems deploying a Sharded config for certain versions of Mongo 3.

The problems I’ve found so far are in hooks.py:

• (Mongo V3.2) The enable_mongos function --configdb option is writing the config servers string syntax in SCCC format and not CSRS.
To solve this, simple change the config server string like this (config server replica set name followed by forward slash):
mongos --configdb ${replSet}/confServer1:port1,confServer2:port2,confServer3:port3
Reference: https://docs.mongodb.com/v3.6/reference/program/mongos/#sharded-cluster-options

• (Mongo V3.6) Shard Servers now require a --shardsvr option when the mongod process is spawned. I haven’t traced the code in the charm yet but “shardsvr” is not located anywhere. Maybe reloading each Replicaset mongod when the shard relationship to mongos is enabled? Or maybe just reading the config file and setting the --shardsvr option during the initial spawn?
Reference - https://docs.mongodb.com/v3.6/reference/program/mongod/#cmdoption-mongod-shardsvr

Also, there are a couple other simple fixes I outlined a while ago that are necessary to do before tackling the list above that affected Mongo V2.4. Here are those changes:

In config_changed function:
enable_configsvr(config_data['port_number']) -> enable_configsvr(config_data)
enable_mongos(config_data['mongos_port']) -> enable_mongos(config_data)

In configsvr_relation_changed, add the enable_configsvr line to the function.
    juju_log("configsvr_relation_changed")
    config_data = config()
    my_port = config_data['config_server_port']
    disable_configsvr(my_port)
+ enable_configsvr(config_data)

Is anybody else using this charm for sharded cluster deployment?

Charles

Xav Paice (xavpaice)
Changed in charm-mongodb:
assignee: nobody → Xav Paice (xavpaice)
status: New → In Progress
Revision history for this message
Xav Paice (xavpaice) wrote :

Tested this out, at least using the documentation and Mongo 3.6 I can confirm that sharding doesn't work.

Changed in charm-mongodb:
status: In Progress → Triaged
importance: Undecided → Medium
importance: Medium → High
assignee: Xav Paice (xavpaice) → nobody
Edin S (exsdev)
Changed in charm-mongodb:
assignee: nobody → Edin S (exsdev)
Revision history for this message
Charles Clark (charlesweb) wrote :

Hey all. Just wanted to bring a bit more attention on this bug report. There are two more changes that need to be made before it can be closed out.

1) Enabling configsvr -- Very quick change

Currently:
enable_configsvr(config_data["config_server_port"])

Proposed:
enable_configsvr(config_data)

2) Enabling Shard Servers

Here's my notes from above:

(Mongo V3.6) Shard Servers now require a --shardsvr option when the mongod process is spawned. I haven’t traced the code in the charm yet but “shardsvr” is not located anywhere. Maybe reloading each Replicaset mongod when the shard relationship to mongos is enabled? Or maybe just reading the config file and setting the --shardsvr option during the initial spawn?
Reference - https://docs.mongodb.com/v3.6/reference/program/mongod/#cmdoption-mongod-shardsvr

Revision history for this message
Charles Clark (charlesweb) wrote :

The latest version is looking good. Lots of nice changes.

I did come across a couple bugs that I mentioned above. Very simple to change.

I don't use this charm for Sharding purposes but I don't think it can without these changes, and potentially the --shardsvr flag mentioned above.

Here are my notes:

BUG: in enable_mongos function, when calling disable_mongos (line 1081), config_data['mongos_port'] is not passed as a parameter and should be.

BUG: looks like the wrong parameters are passed to enable_configsvr in the config_changed function, line 1372):
    * CURRENTLY: enable_configsvr(config_data["config_server_port"])
    * SHOULD BE: enable_configsvr(config_data)
    * config_data is all that is requested by enable_configsvr

BUG: Similar to the one above, when calling enable_mongos in config_changed function (line 1388):
    * CURRENTLY: enable_mongos(config_data["mongos_port"])
    * SHOULD BE: enable_mongos(config_data)
    * config_data is all that is requested by enable_mongos

Eric Chen (eric-chen)
Changed in charm-mongodb:
importance: High → Medium
Revision history for this message
Eric Chen (eric-chen) wrote :

This charm is no longer being actively maintained. Please consider using the new mongodb-operator on k8s platform instead. (https://github.com/canonical/mongodb-k8s-operator).
I will close this issue.

Changed in charm-mongodb:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.