mongo 辅助节点-奇怪的日志条目

mongo 辅助节点-奇怪的日志条目

我有一个包含 4 个节点的 mogodb 集群,所有节点都在标准 27017 端口上工作。我在mongod.log辅助节点上发现了一些奇怪的事情:

{"t":{"$date":"2022-03-26T23:22:34.593+03:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn12132","msg":"Connection ended","attr":{"remote":"<PRIMARY_IP>:42994","connectionId":12132,"connectionCount":143}}
{"t":{"$date":"2022-03-26T23:22:35.065+03:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn12133","msg":"Connection ended","attr":{"remote":"<PRIMARY_IP>:43004","connectionId":12133,"connectionCount":142}}
{"t":{"$date":"2022-03-26T23:22:35.106+03:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn12129","msg":"Connection ended","attr":{"remote":"<PRIMARY_IP>:41906","connectionId":12129,"connectionCount":141}}
{"t":{"$date":"2022-03-26T23:22:41.555+03:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"<PRIMARY_IP>:57280","connectionId":12202,"connectionCount":142}}
{"t":{"$date":"2022-03-26T23:22:41.560+03:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn12202","msg":"client metadata","attr":{"remote":"<PRIMARY_IP>:57280","client":"conn12202","doc":{"driver":{"name":"PyMongo","version":"4.0.1"},"os":{"type":"Linux","name":"Linux","architecture":"x86_64","version":"5.4.0-67-generic"},"platform":"CPython 3.9.4.final.0"}}}
{"t":{"$date":"2022-03-26T23:22:41.611+03:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"<PRIMARY_IP>:57296","connectionId":12203,"connectionCount":143}}
{"t":{"$date":"2022-03-26T23:22:41.612+03:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn12203","msg":"client metadata","attr":{"remote":"<PRIMARY_IP>:57296","client":"conn12203","doc":{"driver":{"name":"PyMongo","version":"4.0.1"},"os":{"type":"Linux","name":"Linux","architecture":"x86_64","version":"5.4.0-67-generic"},"platform":"CPython 3.9.4.final.0"}}}
{"t":{"$date":"2022-03-26T23:22:41.755+03:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"<PRIMARY_IP>:57312","connectionId":12204,"connectionCount":144}}
{"t":{"$date":"2022-03-26T23:22:41.756+03:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn12204","msg":"client metadata","attr":{"remote":"<PRIMARY_IP>:57312","client":"conn12204","doc":{"driver":{"name":"PyMongo","version":"4.0.1"},"os":{"type":"Linux","name":"Linux","architecture":"x86_64","version":"5.4.0-67-generic"},"platform":"CPython 3.9.4.final.0"}}}
{"t":{"$date":"2022-03-26T23:22:41.807+03:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"<PRIMARY_IP>:57324","connectionId":12205,"connectionCount":145}}
{"t":{"$date":"2022-03-26T23:22:41.808+03:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn12205","msg":"client metadata","attr":{"remote":"<PRIMARY_IP>:57324","client":"conn12205","doc":{"driver":{"name":"PyMongo","version":"4.0.1"},"os":{"type":"Linux","name":"Linux","architecture":"x86_64","version":"5.4.0-67-generic"},"platform":"CPython 3.9.4.final.0"}}}

我看到不同端口上有一些奇怪的连接,我不明白那是什么。这是正常的吗?


服务器受ufw防火墙保护,但我的节点可以完全访问彼此(在任何端口上)。端口27017从外部打开。

这是/etc/mongod.conf,在所有节点上都是一样的:

storage:
  dbPath: /mnt/data
net:
  port: 27017
  bindIp: 0.0.0.0
security:
  authorization: enabled
  keyFile: /mnt/data/mongodb.key
replication:
  replSetName: rs0
systemLog:
  path: /mnt/data/mongod.log
  destination: file
  logAppend: true
operationProfiling:
  mode: slowOp
  slowOpThresholdMs: 50

ufw状态:

22                         LIMIT       Anywhere  
27017                      ALLOW       Anywhere                  
Anywhere                   ALLOW       <MY_ANOTHER_SERVER_IP>  
Anywhere                   ALLOW       <MY_ANOTHER_SERVER_IP>
Anywhere                   ALLOW       <MY_ANOTHER_SERVER_IP>
Anywhere                   ALLOW       <MY_ANOTHER_SERVER_IP>                    
22 (v6)                    LIMIT       Anywhere (v6)  
27017 (v6)                 ALLOW       Anywhere (v6)

答案1

MongoDB 使用以下临时端口:

https://en.wikipedia.org/wiki/Ephemeral_port

相关内容