1. Describe your incident:
This is my graylog conf
/etc/graylog/server/server.conf
is_leader = true
node_id_file = /etc/graylog/server/node-id
password_secret = "secret"
root_password_sha2 = "secret"
bin_dir = /usr/share/graylog-server/bin
data_dir = /var/lib/graylog-server
plugin_dir = /usr/share/graylog-server/plugin
http_bind_address = 172.16.231.196:9000
stream_aware_field_types=false
elasticsearch_hosts = http://172.16.231.30:9200,http://172.16.231.41:9200
allow_leading_wildcard_searches = false
allow_highlighting = true
output_batch_size = 500
output_flush_interval = 1
output_fault_count_threshold = 5
output_fault_penalty_seconds = 30
processbuffer_processors = 5
outputbuffer_processors = 3
processor_wait_strategy = blocking
ring_size = 65536
inputbuffer_ring_size = 65536
inputbuffer_processors = 2
inputbuffer_wait_strategy = blocking
message_journal_enabled = true
message_journal_dir = /var/lib/graylog-server/journal
lb_recognition_period_seconds = 3
mongodb_uri = mongodb://graylog:qwerty12345@sras041.hello.se:27017,graylog:qwerty12345@sras042.hello.se:27017,graylog:qwerty12345@sras043.hello.se:27017/graylog2023?replicaSet=graylog
mongodb_max_connections = 1000
And this is my mongo conf.
/etc/mongod.conf
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
processManagement:
timeZoneInfo: /usr/share/zoneinfo
net:
port: 27017
bindIp: 127.0.0.1, 172.16.231.196 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
security:
authorization: "enabled"
keyFile: "/etc/mongodb-keyfile"
replication:
replSetName: "graylog"
And this is what i did when i setup my mongo first time. Running mongosh
rs.initiate()
rs.add("$IP")
rs.add("$IP")
use admin
db.createUser(
{
user: "graylog-admin",
pwd: "abc123", // replace with a strong password
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "clusterMonitor", db: "admin" }
]
}
)
db.createUser(
{
user: "graylog",
pwd: "qwerty12345",
roles: [ { role: "readWrite", db: "graylog2023" } ]
}
)
And this is my error from the graylog.log.
I do not know why it complain that i use invalid char when i do not have it.
I can connect to mongo using my user cred.
mongosh mongodb://graylog:qwerty12345@sras041.hello.se:27017/graylog2023
Caused by: java.lang.IllegalArgumentException: The connection string contains invalid user information. If the username or password contains a colon (:) or an at-sign (@) then it must be urlencoded
at com.mongodb.ConnectionString.<init>(ConnectionString.java:339) ~[graylog.jar:?]
at com.mongodb.MongoClientURI.<init>(MongoClientURI.java:258) ~[graylog.jar:?]
at org.graylog2.configuration.MongoDbConfiguration.getMongoClientURI(MongoDbConfiguration.java:53) ~[graylog.jar:?]
at org.graylog2.configuration.MongoDbConfiguration.validate(MongoDbConfiguration.java:58) ~[graylog.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at com.github.joschi.jadconfig.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:53) ~[graylog.jar:?]
at com.github.joschi.jadconfig.JadConfig.invokeValidatorMethods(JadConfig.java:233) ~[graylog.jar:?]
... 5 more
2. Describe your environment:
Red hat 9.2 Plow
graylog graylog-server-5.1.2-1.x86_64
mongodb-org-6.0.6-1.el9.x86_6
Running 3 graylog servers, every graylog server has mongodb.