If you have max memory of 8gb, better to have your dataset fitting in half of that. There are scenarios wherein the master node might require to use exact same amount of memory as data set to replicate onto slave node. So, at that point in time, memory usage might shoot up.
Also, as mentioned above, you need to setup cache eviction policy.
One more option is to shard out your data if the dataset keeps growing.
Thanks,
Madhava