jail redundacy

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
Hello everybody, I run a Truenas server. in this there are 4 HDDs which run in a mirror. So two mirror pools with two HDDs each. A Nextcloud plugin / jail is running in each of the two pools. I am currently doing a backup every 3 hours with a replication task and snapshots on another server. There are also two pools here, each with a disk for the backups. What I want to do now is the following, if the main server fails, the backup server should take over and take over the two Nextcloud plugins so that I can continue to access them. But that is still not possible at the moment. Because no jails / plugins are displayed in the backup server. Can someone tell me or help me what the problem and the solution is.

Leonard
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If you replicate the jail dataset with the same layout to some pool on your backup system, you need to do iocage activate <poolname> for the jails to be noticed.
Only thing is that the datasets must be read-only on the backup system for the replication to work. As soon as you change a single block on the backup, replication will fail.

Also replication is way simpler than failover. There is no out of the box product that can do that, currently.
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
Hi, at first thank you for your help.

If I run this cmd in Putty I get the following result.
Code:
root@truenas[~]# iocage activate rep-seniorenmutter
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/logging/config.py", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/local/lib/python3.8/logging/config.py", line 744, in configure_hand                                                                                                                                                             ler
    result = factory(**kwargs)
  File "/usr/local/lib/python3.8/logging/handlers.py", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.8/logging/handlers.py", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1143, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1172, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/var/log/iocage.log'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/iocage", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 764, in __ca                                                                                                                                                             ll__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1134, in inv                                                                                                                                                             oke
    Command.invoke(self, ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 956, in invo                                                                                                                                                             ke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 555, in invo                                                                                                                                                             ke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/iocage_cli/__init__.py", line 223                                                                                                                                                             , in cli
    logger = IOCLogger()
  File "/usr/local/lib/python3.8/site-packages/iocage_cli/__init__.py", line 148                                                                                                                                                             , in __init__
    logging.config.dictConfig(default_logging)
  File "/usr/local/lib/python3.8/logging/config.py", line 808, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/local/lib/python3.8/logging/config.py", line 570, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'file'
root@truenas[~]#


What did you mean with replication? At the moment I replication tasks with Snapshots. Is that the Same?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
OK, so I read that you replicate (snapshot tasks & replication tasks, correct) <srcpool>/iocage on the active system to <dstpool>/iocage on the backup system. In that case it should be possible to use iocage activate <dstpool> on the backup system to make the jails visible. IMHO it is necessary to recursively replicate the entire iocage dataset to the backup to be able to use the jails.
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
Okay, when I see it correctly in my dashboard and in you message I have to change in ghe destination system to dstpool/iocage and not only dstpool right?

what means IMHO?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
In My Humble Opinion.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Didn't you write that you already do replication?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Will TrueNAS even let you have jails running on two different pools on the same instance? I can see how replicating the jail to the second pool would be a good backup (assuming you've got everything you need for Nextcloud inside the jail) and you could switch between pools if one died, but it's probably not very likely and wouldn't be an automated process.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
No, I thought he was replicating to a second backup system?

You can replicate to a second pool.
You can replicate to a second system.
The replica is set to read-only.
If the primary pool fails you can remove the read-only flag, activate the second pool and start the jails from there.
If your primary system fails you can remove the read-only flag on the second system and start the jails there.

You cannot have jails running from two pools at the same time. Limitation of iocage.
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
Will TrueNAS even let you have jails running on two different pools on the same instance? I can see how replicating the jail to the second pool would be a good backup (assuming you've got everything you need for Nextcloud inside the jail) and you could switch between pools if one died, but it's probably not very likely and wouldn't be an automated process.
My Backup System is a different Server, its Not the Same System
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
No, I thought he was replicating to a second backup system?

You can replicate to a second pool.
You can replicate to a second system.
The replica is set to read-only.
If the primary pool fails you can remove the read-only flag, activate the second pool and start the jails from there.
If your primary system fails you can remove the read-only flag on the second system and start the jails there.

You cannot have jails running from two pools at the same time. Limitation of iocage.
Yes the Backupserver is a different System.
how can I change to read only? Is that the reason that I couldnt see the jails?

leonard
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
That happens automatically - look at your replication task settings. There's a read-only parameter in there.
You cannot see the jails because you need to replicate everything from <sourcpool>/iocage to <backuppool/iocage. And then activate the pool on the backup system. You cannot start the jails, though, because they should be read-only.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Hello everybody, I run a Truenas server. in this there are 4 HDDs which run in a mirror. So two mirror pools with two HDDs each. A Nextcloud plugin / jail is running in each of the two pools.
Leonard

???
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
That happens automatically - look at your replication task settings. There's a read-only parameter in there.
You cannot see the jails because you need to replicate everything from <sourcpool>/iocage to <backuppool/iocage. And then activate the pool on the backup system. You cannot start the jails, though, because they should be read-only.
Hi, where can I find the read only parameter? I cant find it.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
On the Main System are two pools with jails and on the backup system are also two pools but without jails at the moment
You can only have one pool with jails active on each system. So on the primary system you can replicate the jails to a different pool, but you won't see these replicas in the "Jails" UI. If the first pool fails you can manually restore the jail datasets from this backup after you have repaired the first pool.

If you replicate to a second system you will be able (I guess) to see the jails in the UI after you used iocage activate, but you won't be able to start them, because the replicas must be read-only for incremental replication to work.

Hi, where can I find the read only parameter? I cant find it.
Please see attached screenshot.

Bildschirmfoto 2021-04-12 um 14.11.58.png
 

Leonard Lassen

Explorer
Joined
Nov 19, 2020
Messages
82
Okay, for the first backup pool it is now working. But by the second Backup pool I get the following in the Jails. I typed in the cmd iocage activate <poolname> and after that I get the same Error as every time... its in read only mode

Leonard
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
OK, so you cannot activate it when in read-only mode. OK. But you have a backup.
In case your primary system fails, you can go to Storage --> Pools --> the dataset in question
and set it to read/write, then use iocage activate and start your jails. Proper backup solution if you ask me.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I'm still struggling with the description that you are running jails from two separate pools on the same TrueNAS server, and then replicating these to another TrueNAS server with two pools and trying to enable both of these. If that were possible, you'd have 4 Nextcloud jails running across 2 TrueNAS servers!
 
Top