-
Hello, folks, I'm relying on Netbox for my automation, and different scripts and robots are using it more and more frequently. So, the natural question came - how are you managing highly available installations? It does not look like there is much information on this matter. Thanks for creating such a great product! Any advice is much appreciated! Kind regards, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
80% of making Netbox HA is making Postgres HA. Once you've done that, you can have multiple frontends all pointing to the same Postgres database or cluster, stick them behind a load-balancer, and they'll happily share the load or take over from each other. 10% is making Redis HA - since multiple netbox and netbox-rq workers will need to point to the same Redis instance. The remaining 10% is sharing the media directory (/opt/netbox/netbox/media), and the reports and scripts directories. The media directory can be shared using NFS (in which case you will need a HA NFS server), or you can configure Netbox to store its media on S3 instead. The reports and scripts directories can be periodically rsync'd from a master location, or pushed out using your configuration management system. If you just want disaster recovery rather than HA, then it's somewhat simpler. Configure your master postgres server to replicate to a backup postgres server in another data centre, and sync the media/reports/scripts directories. When you need to cutover in disaster, then promote the replica database to master. You may lose any in-flight background tasks or webhook events in Redis; if that's important you could configure Redis leader-follower replication too. However to be honest, if the whole primary data centre goes down, and you're only doing asynchronous replication between sites, you may lose the most recently-written data anyway. Alternatively you could outsource this, and use one of the cloud-managed Postgres services (e.g. AWS RDS) and Redis services (e.g. AWS MemoryDB). Soon you'll be able to outsource your entire Netbox instance to NS1 :-) |
Beta Was this translation helpful? Give feedback.
-
I was looking through this and I don't mind an active/backup setup, so I am really only looking to get Postgres in HA mode. That being said, how does this work with upgrading the two instances. I am sure instance 1 will upgrade no problem, but what about instance two? |
Beta Was this translation helpful? Give feedback.
-
For any future readers. If you configure Netbox with Postgres in a hot/standby config, you need to add the following config so that the backup system will allow user sign in. (credits to #3118 and #3196 ) In MAINTENANCE_MODE=True # this allows the server to connect to the local read-only db
SESSION_FILE_PATH="/opt/netbox/netbox/sessionFile" # this will have netbox write sessions to local storage instead of the database. you will need to run `mkdir /opt/netbox/netbox/sessionFile` which needs to be owned by the netbox user In AUTH_LDAP_ALWAYS_UPDATE_USER = False #stops ldap from updating the database, needed for readonly databases
`` |
Beta Was this translation helpful? Give feedback.
80% of making Netbox HA is making Postgres HA. Once you've done that, you can have multiple frontends all pointing to the same Postgres database or cluster, stick them behind a load-balancer, and they'll happily share the load or take over from each other.
10% is making Redis HA - since multiple netbox and netbox-rq workers will need to point to the same Redis instance.
The remaining 10% is sharing the media directory (/opt/netbox/netbox/media), and the reports and scripts directories. The media directory can be shared using NFS (in which case you will need a HA NFS server), or you can configure Netbox to store its media on S3 instead. The reports and scripts directories can be periodical…