A
A
Artem Prokhorov2021-12-05 23:40:54
MongoDB
Artem Prokhorov, 2021-12-05 23:40:54

How to permanently put the owner of a .sock file on mongodb?

And I deleted this file, and manually set the rights to mongodb. The file is simply re-created after the mongod | sudomongod | sudo systemctl start mongod. And of course with root.
The logs still show this:

{"t":{"$date":"2021-12-05T20:20:34.514+00:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2021-12-05T20:20:34.517+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-12-05T20:20:34.535+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-12-05T20:20:34.536+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-12-05T20:20:34.536+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":7151,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"vm-e36ee522"}}
{"t":{"$date":"2021-12-05T20:20:34.536+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.8","gitVersion":"83b8bb8b6b325d8d8d3dfd2ad9f744bdad7d6ca0","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-12-05T20:20:34.536+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-12-05T20:20:34.536+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/var/lib/mongodb","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
{"t":{"$date":"2021-12-05T20:20:34.537+00:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2021-12-05T20:20:34.537+00:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-12-05T20:20:34.537+00:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}


In general, some kind of game, if you have any manuals for installing mongo on ubuntu, HERE IS SO THAT I installed and worked.
I understand that this is not mysql and I don't mind fiddling with the config, BUT I don't really understand why for almost a whole day I can't start the process and connect to it from the same machine on which the process is running. Either 13 is an error, or 14, or 100. The files that are from the installation manual on ubuntu are put on root, and then they swear at the same root.
In --journal mode, everything starts, you just need to split the terminal in order to prescribe mongo there, which ironically works in this case, and be kind and also open 3 terminals (3 times in order to work with the system already, so 2 others are tied to your process).

PS
Version 4.4 (I am aware that the five has problems with some processors, my vps just does not have the right one)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nowm, 2021-12-06
@kotcich

Look at the mongod service configuration. It must be in the file /lib/systemd/system/mongod.service.
The section title [Service]should be followed by these lines:

User=mongodb
Group=mongodb

This affects who will own the file /tmp/mongodb-27017.sock. Also, it’s better to start / restart the service only with the sudo systemctl start mongod.service
More command, judging by the fact that your command systemctlsays mongod, and not mongod.service, you probably use your own configuration to start, and then you need to edit another file - you should be aware of which one because they probably wrote it themselves. In the original service configuration file, which is created by default after installing MongoDB, the target user / group is written correctly and does not create problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question