openwisp / ansible-openwisp2

Ansible role that installs and upgrades OpenWISP.
https://openwisp.io/docs/dev/ansible/
BSD 3-Clause "New" or "Revised" License
474 stars 136 forks source link

Migrating VM between Datacenters. #446

Closed momothefox closed 11 months ago

momothefox commented 11 months ago

Hi, I used this command to migrate files from VM1 to VM2 rsync -avz --exclude=/proc --exclude=/sys --exclude=/dev --exclude=/run --exclude=/boot --exclude=/cdrom / VM2_IP:/ and i updated my DNS record to point to the new IP

Openwisp is working now on the new server but i have errors in monitoring devices and checks .

/opt/openwisp2/log/openwisp2.log

[WARNING 2023-09-05 15:49:30,092] module: log, process: 5629, thread: 140401092122432
Not Found: /api/v1/monitoring/device/fa294f2a85c049898f7c27054703b591/

[WARNING 2023-09-05 15:49:30,410] module: log, process: 5629, thread: 140401092122432
Not Found: /api/v1/monitoring/device/50f3a17cd496421794bd5b11ca06690e/

[WARNING 2023-09-05 15:49:30,549] module: log, process: 5629, thread: 140401092122432
Not Found: /api/v1/monitoring/device/de9c4e6ee3154585b2fd72f020888746/

Online status of devices are not working the right way. something wrong

Any help would be appreciated,

beadon commented 11 months ago

the UUID of the server probably(?) changed , the /boot directory will have some unique characteristics -- to move the VM I recommend duplicating the entire storage device, this rsync seems risky.

momothefox commented 11 months ago

Thank you for your suggestions @beadon . but note that i do not have access for physical machines on both Datacenters This is number 1

Number 2 : Devices which are already registered some of them is showing online (OK) and the rest are showing offline (Critical) No ping. (which is not correct in most cases)

Number 3 : if i reseted a device to factory setting, device gets reregister it self on the server but Monitoring status dose not change.

Number 4 : If a new Device register to the server. it is functioning as expected correctly.

momothefox commented 11 months ago

i think api server is not running.

root@wisp:~# curl http://localhost:8000/api/v1/docs/
curl: (7) Failed to connect to localhost port 8000: Connection refused
root@wisp:~# GET http://localhost:8000/api/v1/docs/
Can't connect to localhost:8000 (Connection refused)

Connection refused at /usr/share/perl5/LWP/Protocol/http.pm line 50.
momothefox commented 11 months ago

part of /opt/openwisp2/log/nginx.error.log

2023/09/08 19:35:25 [error] 195345#195345: *838601 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=07-09-2023_11:02:52.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:26 [error] 195345#195345: *838606 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=07-09-2023_12:48:38.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:26 [error] 195345#195345: *838610 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=04-09-2023_12:56:39.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:27 [error] 195345#195345: *838616 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=07-09-2023_16:22:30.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:27 [error] 195345#195345: *838618 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=08-09-2023_08:35:05.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:28 [error] 195345#195345: *838625 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=07-09-2023_11:02:52.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
2023/09/08 19:35:28 [error] 195345#195345: *838627 readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: x.x.com, request: "POST /api/v1/monitoring/device/UUID/?key=KEY&time=07-09-2023_12:48:38.000000 HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "x.x.com"
momothefox commented 11 months ago

Fresh Installation with DB backup worked fine