OTAA and AS/NS restart: nodes lost forever

I have many devices working with OTAA. If I restart the AS/NS, the devices will never join again. How should we handle this problem? Is like that by design? The culprit seems to be the node or the AS/NS should save the keys when rebooting?

The keys are stored in Redis, make sure you have an understanding of Redis persistence and have it configured to your needs. Also, make sure you understand the rejoin mechanics and configuration of your devices. Ours are set to rejoin after X failed confirmed packets.

As an addition, please see https://redis.io/topics/persistence for the Redis persistence options.