NEX — installation and configuration
By Roberto Arato of aratoingegneria.it
This guide takes you from a few freshly installed Linux machines to a working
NEX cluster: shared home folders, jobs that run on any node, a web dashboard.
You do not need to be a programmer. You need to be comfortable with a Linux
terminal: logging in with ssh, running commands with sudo, editing a file.
The first part is a step-by-step tutorial: follow it in order. The second part is a reference: configuration files, upgrades, removal, optional services, troubleshooting. You can come back to it later.
Other guides: for everyday use, the User guide and nexsh; for a worked example on three PCs, NEX on real machines; to try NEX without installing anything, the ready-made images.
Contents
Before you start
Step by step
- Prepare every machine
- Install the packages
- Set up the first node
- Add the other nodes
- Three copies of the data
- Create the first user
- Open the dashboard
- After the installation: what to keep safe
Reference
- Configuration files
- Storage nodes: status, maintenance, removal
- Optional services and features
- Checking a node
- Upgrading
- Removing a node
- Troubleshooting
- What the packages contain
Part one: before you start
1. How a NEX cluster is made
A NEX cluster is a group of Linux machines (nodes) that work as one computer. Users log in to any node and find the same home folder, the same files and the same accounts; they can run programs on the least busy node, or on a chosen one.
your network (TCP 7440 agents, 7400 storage, 7443 dashboard)
----------+----------------------+----------------------+-----------
| | |
+-------+--------+ +-------+--------+ +-------+--------+
| node-a | | node-b | | node-c |
| FIRST NODE | | compute+storage| | compute+storage|
| compute+storage| | | | |
| cluster CA | | | | |
| disk for data | | disk for data | | disk for data |
+-------+--------+ +-------+--------+ +-------+--------+
| | |
+----------- /nex (NEXFS, shared) -----------+
the same files, seen from every node
The pieces, in plain words:
- Node. One machine of the cluster. Each node runs a small program, the
agent (
nexagentd), that talks to the agents of the other nodes. - The first node (also called the admin node). The node where you create the cluster. It keeps the cluster's certificate authority (below), and new nodes join "through" it. Apart from that it is a node like the others.
- Roles. Every node has one or both of these roles:
- compute: the node runs users' programs and shows the shared folder
/nex. Users log in to compute nodes. - storage: the node keeps part of the cluster's data on its own disk. A small cluster usually gives both roles to every node.
- compute: the node runs users' programs and shows the shared folder
/nexand NEXFS./nexis the folder that every compute node sees with the same content: home folders are in/nex/home, projects in/nex/progetti. Behind it is NEXFS, the distributed filesystem that comes with NEX: it spreads the data over the disks of the storage nodes and keeps several copies, so a broken machine loses nothing. NEX installs and configures NEXFS by itself.- Meta nodes and data nodes. Inside NEXFS, a storage node plays one or two parts. As a data node it stores blocks of files on its disk. As a meta node it also keeps the "index": names, folders, permissions. The first three storage nodes become meta nodes as well; they decide by majority, so with three of them the cluster keeps working if one stops. Storage nodes after the third one are data nodes only. You do not choose this: NEX does it.
- The cluster CA. The nodes talk to each other only over encrypted,
mutually authenticated connections. Each node proves who it is with a
certificate, and all certificates are signed by the cluster's own
certificate authority (CA). You create the CA yourself, on the first
node, with one command: there is nothing to buy and no external certificate
is needed. It lives in
/etc/nex/caon the first node. Whoever has it can let machines into the cluster, so keep it safe and keep a backup copy.
The path you will follow:
every machine: prepare (name, clock, ssh) -> install the packages
first node: configuration -> CA -> storage -> services
other nodes: one command each: sudo nex-setup --from node-a
then: three copies -> first user -> dashboard
2. What you need
Machines. At least one; three or more for a cluster that survives the loss of a machine. Real servers, PCs or virtual machines all work.
Processor. 64-bit PCs and servers (amd64); with Debian 13 also 64-bit ARM machines (arm64): apt picks the right packages by itself, and the steps of this guide are the same.
Operating system, the same on every node:
- Debian 13 (trixie), or
- Ubuntu 26.04 LTS (resolute).
Linux kernel 6.12 or later; a newer one (for Debian, the one from backports) is better.
Network. Every node must reach every other node. Give each node a fixed address (a DHCP reservation in your router is fine). Open these TCP ports between the nodes if there is a firewall:
Port Used by 22 ssh, used while adding nodes 7440 the NEX agents 7400 NEXFS (storage and /nex)7443 the web dashboard (also from users' PCs) A disk, or at least a folder, for the data on every storage node. A dedicated second disk is best. Without one, NEXFS uses a folder on the system disk (
/var/lib/nexfs/disco0).An administrator account on every machine: a normal user that can use
sudo(in this guide,admin).Internet access to download the packages (or the
.debfiles copied by hand).
3. The easiest way to try: the ready-made images
If you just want to see NEX at work, start with the
ready-made virtual machine images for VirtualBox, VMware or
Proxmox, or with the NEX Live USB stick, which starts on a PC
without installing anything. There are three images, and you choose them by
desktop, not by role: nex-cluster-desktop-gnome, nex-cluster-desktop-xfce
and nex-cluster without a desktop. The role is chosen at the first
boot: whether the node creates a new cluster or joins an existing one, and
whether it runs programs (compute), keeps data (storage) or both.
With a desktop, NEX Setup opens by itself; without a desktop a guided procedure on the console asks for the language, keyboard, network, node name and passwords. Then everything described in §6 (configuration, CA, certificates, encrypted storage, services, first user) and in §7 happens by itself. It takes a few minutes.
Every image has a 20 GB disk for the data, and three copies of the same image are already a real cluster with three copies of the files: the copies grow by themselves as storage nodes join. To install NEX on your own machines, with the disks and network you choose, follow the steps below.
Part two: step by step
In the examples the nodes are called node-a, node-b and node-c, with addresses 10.20.0.10, 10.20.0.11 and 10.20.0.12, and the administrator user is admin. Replace them everywhere with your own names and addresses.
4. Prepare every machine
Do this on every machine, before installing NEX.
4.1 Names and addresses
Each node needs a short name (lowercase letters, digits and -) and must be
able to find the others by name. The simplest way is the /etc/hosts file,
the same on every node:
sudo hostnamectl set-hostname node-a # node-b on the second machine, and so on
sudo tee -a /etc/hosts <<'EOF'
10.20.0.10 node-a
10.20.0.11 node-b
10.20.0.12 node-c
EOF
Check: ping -c1 node-b (and the other names) answers from every node.
If your network has a DNS server that already knows the names, you can skip
the /etc/hosts part. The names matter: node certificates carry the node
name, and the dashboard is opened by name.
4.2 The clock
Certificates and logs need the clocks of the nodes to agree.
sudo apt install systemd-timesyncd
timedatectl | grep synchronized
You should see: System clock synchronized: yes.
4.3 Access for adding nodes: sudo and ssh
When you add a node (§7), the command nex-setup runs on the new node and
uses ssh to reach the first node and the other nodes, as the user that
ran sudo. On the other side it runs commands with sudo, without being
able to type a password. So, during the installation:
On every machine, let admin use sudo without a password. You can
remove this when the installation is finished (§11).
echo "admin ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/nex-installazione
sudo chmod 440 /etc/sudoers.d/nex-installazione
On every machine except the first, create an ssh key for admin and
copy it to every node that is already in the cluster (at the beginning, just
node-a; later also node-b, and so on):
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 # only once per machine
ssh-copy-id node-a # asks once for admin's password on node-a
ssh-copy-id node-b # ... and on every other node already added
Check: ssh node-a sudo -n true && echo ok prints ok without asking
anything.
If you already manage your servers with an ssh key on your own PC, you can use that instead: see "ssh access" in §7.
4.4 The data disk (storage nodes)
With a second disk (here /dev/sdb: lsblk shows the right name, the
disk without mounted partitions). Everything on that disk is erased.
lsblk
sudo mkfs.ext4 -L nexfs /dev/sdb
sudo mkdir -p /srv/nexfs/disco0
echo "LABEL=nexfs /srv/nexfs/disco0 ext4 defaults,noatime 0 2" | sudo tee -a /etc/fstab
sudo mount /srv/nexfs/disco0
Without a second disk, just create the folder (or use the default
/var/lib/nexfs/disco0 and leave out --disk in the commands below):
sudo mkdir -p /srv/nexfs/disco0
Check: df -h /srv/nexfs/disco0 shows the size of the data disk.
5. Install the packages
Do this on every machine.
5.1 From the APT repository (recommended)
The Arato Ingegneria repository is public and signed. As root (sudo -i):
# 1. the repository key
curl -fsSL https://nex.aratoingegneria.it/apt/nex-archive-keyring.gpg \
-o /usr/share/keyrings/nex-archive-keyring.gpg
# 2. check it (gpg is in the gnupg package): the fingerprint must be exactly this one
gpg --show-keys /usr/share/keyrings/nex-archive-keyring.gpg # 30D4 902B 708E 39D4 B8FB 07FF 7C0E 601B D118 1C30
# 3. the repository: Suites is "trixie" on Debian 13, "resolute" on Ubuntu 26.04
cat > /etc/apt/sources.list.d/nex.sources <<'EOF'
Types: deb
URIs: https://nex.aratoingegneria.it/apt
Suites: trixie
Components: main
Signed-By: /usr/share/keyrings/nex-archive-keyring.gpg
EOF
# 4. the packages
apt update && apt install nex-cluster
- On Ubuntu 26.04 write
Suites: resoluteinstead ofSuites: trixie. The Ubuntu packages are the same programs built for Ubuntu; their version ends with~ubuntu26.04(for example1.0.0~beta1~ubuntu26.04). - If on Ubuntu you had written
Suites: trixie(the instructions from before the Ubuntu packages), change it toSuites: resolute, thenapt update: the nextsudo nexctl upgrade --aptmoves to the Ubuntu packages on its own, one node at a time and without stopping the cluster. - On computers with a desktop (GNOME, KDE Plasma or XFCE) also install
nex-desktop: it brings/nexinto the file manager, cluster notifications, NEX Monitor and NEX Setup, the graphical configurator (NEX Setup in the applications menu). With NEX Setup the computer creates a cluster or joins one without the command line: underneath it runsnex-setup(§6, §7). On an installed computer the «cluster password» it asks for to join is the password of your user on the admin node and on the other nodes (the same user name, with sudo, ssh with password and at least 8 characters: NEX Setup uses it once to copy the ssh key); the address of the admin node is typed by hand, because the list of clusters on the network exists only on the USB stick and on the VM images with a desktop. - The package is called
nex-cluster. Do not install the package callednex: it is an unrelated program of the distribution. - The download pages /scarica/debian and /scarica/ubuntu show the same commands, ready to copy.
nex-cluster brings NEXFS with it (package nexfs). Later updates arrive
with apt upgrade; for the whole cluster without interruptions there is
nexctl upgrade (§16).
Check: dpkg-query -W nex-cluster nexfs lists both packages with their
version.
If apt update complains about the key or the signature, the key file is
missing or not the right one: repeat steps 1 and 2. apt does not use a
repository whose signature does not match.
5.2 From .deb files
Without Internet access on the nodes, download the files from the download
page and copy them to every machine (USB stick, scp). In the folder where
they are:
sudo apt install ./nexfs*.deb ./libnexfs0_*.deb ./nex-cluster_*.deb ./libnex0_*.deb
NEXFS comes in several files (nexfs, nexfs-server, nexfs-client,
nexfs-tools, libnexfs0): ./nexfs*.deb takes the first four, and all of
them are needed. apt also installs what is needed from the distribution.
5.3 What happens after the installation
Nothing starts yet. The NEX services wait for the node configuration
(/etc/nex/node.json) and the node certificate, which you create in the next
steps. The installation prints a reminder:
nex: nodo non ancora configurato ("node not configured yet"). That is
expected.
6. Set up the first node
This is done once, on the machine that will be the first node (node-a). On the other machines you will use one command instead (§7).
The guided setup (recommended)
One command does the whole first node, asking only what it needs and explaining each question:
sudo nex-setup
Choose 1) Create a new cluster, then answer:
- the name of the node in the cluster (Enter keeps the machine's name);
- its address, chosen from a list of the network cards. If the address comes from DHCP you get a warning: the nodes find each other by address, so make it fixed (a reservation on the router or a static address);
- whether the node also runs programs (compute): on a small cluster, yes;
- where it keeps the cluster data: if the machine has an empty disk, it is
proposed (recommended): it is formatted only after you type its name and
confirm the summary. Otherwise a folder (default
/var/lib/nexfs/disco0).
A summary follows; answer y and in about fifteen seconds the cluster
exists. You should see:
/etc/nex/node.json ... ok (0.1 s)
cluster certificate authority (CA) ... ok (0.3 s)
node certificate signed by the cluster CA ... ok (2.3 s)
disk encryption key (not shown) ... ok (0.0 s)
cluster storage: NEXFS metadata and data node, blocks in /srv/nexfs/disco0 ... ok (5.5 s)
cluster secrets key (not shown) ... ok (0.1 s)
local services ... ok (4.4 s)
shared filesystem /nex ... ok (0.0 s)
cluster users registry ... ok (0.3 s)
Cluster created: node-1 is its first node and its admin node.
Then it offers to create the first cluster user (name and password) and
shows the next steps with this node's address. Nothing to buy or request: the
cluster creates its own certificate authority (CA). Keep a copy of
/etc/nex/ca in a safe place (§11).
The guided setup does not change the network or the machine's name. Without
questions, for scripts:
sudo nex-setup create --node node-a --addr 10.20.0.10 --disk /srv/nexfs/disco0 --yes.
The VM images run this same command at their first boot.
By hand, step by step
The rest of this section does the same by hand, one step at a time: useful to understand what each step creates and why, or to change one of them. In short:
| Step | What it creates | Where |
|---|---|---|
| 6.1 | the node configuration | /etc/nex/node.json |
| 6.2 | the cluster CA and this node's certificate | /etc/nex/ca/, /etc/nex/pki/ |
| 6.3 | the block encryption key and the NEXFS storage | /etc/nexfs/ and the data disk |
| 6.4 | the key for users' secrets | /etc/nex/secrets.key |
| 6.5 | the running services and /nex |
systemd |
| 6.6 | the list of cluster users | /nex/.nex/users.json |
All commands below need root: they start with sudo.
6.1 The node configuration: /etc/nex/node.json
node.json tells NEX who this node is, which roles it has and where its
agent listens. It is a small text file in JSON format. Create it with the
name and address of your first node:
sudo mkdir -p /etc/nex
sudo tee /etc/nex/node.json <<'EOF'
{
"node": "node-a",
"roles": ["compute", "storage"],
"storage": {"type": "nexfs"},
"compute": {"mount": "/nex", "options": ["noatime"], "binds": [], "drain_timeout": 15},
"agent": {"listen": "10.20.0.10", "port": 7440, "peers": []}
}
EOF
sudo nexctl validate
What each line means:
| Field | Meaning |
|---|---|
node |
the node name: use the machine's name (letters, digits, ., _, -) |
roles |
compute, storage, or both, as in the example |
storage |
the shared filesystem: always {"type": "nexfs"} |
compute.mount |
where the shared folder appears: /nex |
compute.options |
how it is mounted: noatime is a good default |
compute.binds |
extra places where parts of /nex also appear; empty is fine (see §12) |
compute.drain_timeout |
seconds of patience when the node leaves the cluster (nexctl leave): how long programs still using /nex get after SIGTERM, and, plus 60, how long to wait for services to move to other nodes; nex-setup writes 15 |
agent.listen |
this node's address, the one the other nodes use to reach it |
agent.port |
the agents' port: 7440 |
agent.peers |
the other nodes: empty now, nex-setup fills it as nodes join |
You should see something like:
{
"valid": true,
"node": "node-a",
"roles": ["compute", "storage"]
}
If it fails: the message names the problem. The most common ones:
agent.listen must be a numeric IPv4 address (write the address, not a
name); a JSON typo such as a missing comma or quote; config must be a root-owned regular file without group/other write (create the file with
sudo as above, and do not make it writable by others).
6.2 The cluster CA and the node certificate
Here you create the cluster's own certificate authority, then use it to give node-a its certificate. Four commands, each with a clear job:
sudo nexctl pki init # 1. create the CA
sudo nexctl pki request # 2. create this node's key and request
sudo nexctl pki sign --csr /etc/nex/pki/node.csr --out /tmp/node-a.crt # 3. the CA signs it
sudo nexctl pki install --cert /tmp/node-a.crt --ca /etc/nex/ca/ca.crt # 4. install it
pki initcreates the CA in/etc/nex/ca: a private key (ca.key, readable by root only) and a certificate (ca.crt) valid for ten years. You run it only once in the life of the cluster; it refuses to overwrite an existing CA.pki requestcreates this node's private key (/etc/nex/pki/node.key) and a certificate request (node.csr) with the node's name. The private key never leaves the node.pki signis what the CA does: it checks the request and writes the signed certificate. Node certificates are valid for two years (730 days;--dayschanges it).pki installchecks that the certificate belongs to this node and to its key, and copies it, with the CA certificate, into/etc/nex/pki.
You should see, after the last command, something like:
{
"node": "node-a",
"dir": "/etc/nex/pki",
"files": {"ca.crt": true, "node.crt": true, "node.key": true},
"valid": true,
"not_after": "Oct 23 10:00:00 2028 GMT",
"key_mode": "0o600"
}
Check later with sudo nexctl pki status: "valid": true.
Keep the CA safe. Copy /etc/nex/ca to a safe place outside the cluster
(an encrypted USB stick, a password manager, a safe). Without it you can no
longer add nodes; with it, anyone can.
If it fails: CA already exists in /etc/nex/ca means a CA is already
there: do not delete it if the cluster is in use. certificate is for 'X', this node is 'Y' means the request was made with a different name in
node.json: fix node.json, then repeat steps 2 to 4.
6.3 The storage: block key and NEXFS
The data written to the storage disks is encrypted. Each storage node has its own block encryption key: 64 random bytes in a file that only root can read, kept off the data disk. If a disk is stolen or thrown away, its content cannot be read without that key.
Create the key, then the first NEXFS node and the filesystem:
sudo install -d -m 755 /etc/nexfs
sudo sh -c 'umask 077; head -c 64 /dev/urandom > /etc/nexfs/blocchi.key'
sudo nexfsctl init --node node-a --address 10.20.0.10 --disk /srv/nexfs/disco0 \
--encryption-key /etc/nexfs/blocchi.key
nexfsctl init makes node-a the first meta node and data node of
NEXFS, with the certificate you have just installed, writes the NEXFS
configuration (/etc/nexfs/nexfs.json), starts the storage service
(nexfsd) and creates the empty filesystem. It takes a few seconds.
You should see:
{"initialized": true, "node": "node-a", "seconds": 2}
Check: sudo nexfsctl health reports "status": "ok"; if it says
warning or error, the reasons field explains why.
Keep a copy of /etc/nexfs/blocchi.key outside the cluster, like the CA.
If it fails: the configuration file already exists: this node is already initialized means nexfsctl init was already run on this machine;
cannot read the node certificates means step 6.2 is not complete;
--encryption-key is on a data disk means the key file is inside the
--disk folder: keep it in /etc/nexfs.
6.4 The secrets key
Users can store small secrets (passwords for databases, API tokens) with
nex secret. They are encrypted with a key that is the same on every compute
node. Create it now, before adding other nodes: nex-setup copies it
automatically to every compute node it adds.
sudo nexctl secrets init
You should see "created": true and a fingerprint (a short code that
identifies the key without showing it). Keep a copy of
/etc/nex/secrets.key outside the cluster. Never run init again on a
cluster in use: the secrets already saved would become unreadable (the
command refuses if the key exists).
6.5 Start the services
sudo systemctl enable --now nexagentd nex-compute nex-users.timer nex-devnodes nex-dashd
| Service | What it does |
|---|---|
nexagentd |
the agent: talks to the other nodes, runs jobs |
nex-compute |
mounts /nex at boot |
nex-users.timer |
applies cluster users to this node every minute |
nex-devnodes |
devices shared between nodes (/devnodes) |
nex-dashd |
the web dashboard on port 7443 |
enable makes them start again at every boot.
Check:
findmnt /nex # a line with the type nexfs
nex nodes
nex nodes should show something like:
NODE STATE COMPUTE MOUNT LOAD CPU MEM FREE JOBS MS
node-a ok yes nexfs 0.05 4 6.1G 0 0.3
If /nex is not mounted, wait a few seconds and look at
journalctl -u nex-compute. If nexagentd does not start, check
sudo nexctl validate and sudo nexctl pki status.
6.6 The list of cluster users
Cluster users live in one file on the shared filesystem. Create it, empty:
sudo nexctl users init
You should see "initialized": true and the file
/nex/.nex/users.json. It needs /nex mounted: if it says needs /nex mounted, go back to the check in 6.5.
The first node is ready. The cluster exists, with one node.
7. Add the other nodes
On each other machine (node-b, node-c, ...), with the packages installed (§5), the easiest way is again the guided setup:
sudo nex-setup
Choose 2) Add this machine to an existing cluster, type the address of
the first node, and say whether this node runs programs (compute) and keeps
cluster data (storage). If this machine cannot reach the first node with ssh
yet, the guided setup creates an ssh key and copies it there: it asks once
for the password of your user on the first node. A summary, y, and in
about ten seconds the node is in the cluster.
The same, without questions, with the options below. With ssh prepared (§4.3), one command adds it to the cluster:
sudo nex-setup --from node-a --roles compute,storage --disk /srv/nexfs/disco0
--fromnames the first node (the one with the CA).--rolesiscompute,storageorcompute,storage.--diskis the data folder of a storage node (default/var/lib/nexfs/disco0). It is not needed for a compute-only node:sudo nex-setup --from node-a --roles compute.
nex-setup proposes the node name (the machine's name) and its address (the
one it uses to reach node-a), shows a summary and asks for confirmation:
$ sudo nex-setup --from node-a --roles compute,storage --disk /srv/nexfs/disco0
nex-setup 2.8.1: adding this node to the cluster via node-a
ssh and sudo access to node-a as admin ... ok (0.4 s)
cluster configuration from node-a ... 1 nodes: node-a (0.1 s)
Node data (Enter to accept):
node name [node-b]:
address for the other agents [10.20.0.11]:
roles (compute, storage or compute,storage) [compute,storage]:
Summary:
node node-b, address 10.20.0.11, roles compute, storage
peers: node-a
shared filesystem /nex (NEXFS)
storage role: NEXFS node with its blocks in /srv/nexfs/disco0 (meta node if the cluster has fewer than three)
Proceed? [y/N] y
Then it works by itself, printing one line per step:
- writes and validates
/etc/nex/node.json; - copies the secrets key from node-a (compute nodes);
- creates the node's key, has the certificate signed by the CA on node-a, and installs it (the private key never leaves the node);
- joins NEXFS: a storage node gets its own block encryption key and becomes a meta node (while there are fewer than three) and a data node; a compute-only node just gets the client configuration;
- starts the services;
- adds the new node to the peers of all the other nodes (their running jobs are not interrupted);
- waits until every node answers, then shows
nex nodesand whether/nexis mounted.
It usually takes less than a minute. You should see at the end
Node node-b added to the cluster. and /nex: nexfs.
Repeat on node-c. Before that, copy node-c's ssh key to node-a and node-b
(§4.3): nex-setup updates every node.
Check, on node-a:
nex nodes # all nodes, all "ok"
sudo nexfsctl meta list # with three storage nodes: three meta nodes, "voting": true
sudo nexfsctl node list # the data nodes, "alive": true
sudo nexfsctl health # "status": "ok"
Without questions (for scripts), and to see what it would do:
sudo nex-setup --from node-a --node node-d --addr 10.20.0.13 --roles compute --yes
sudo nex-setup --from node-a --dry-run
ssh access. nex-setup connects as the user who ran sudo (or the one
given with --ssh-user), with ssh keys only, and runs sudo -n on the other
side. Instead of creating keys on each node (§4.3), you can use the key on
your own PC, forwarded with the ssh agent:
ssh -A node-d 'sudo --preserve-env=SSH_AUTH_SOCK nex-setup --from node-a --yes'
The most common problems (more in §18):
| Message | What to do |
|---|---|
ssh node-a: Permission denied |
the ssh key of this node is not on node-a: ssh-copy-id node-a |
sudo: a password is required |
sudo without password is missing on the other node (§4.3) |
node-b is already in the cluster with address ... |
the name is taken: choose another, or --force to replace the old node |
/etc/nexfs/nexfs.json already exists |
this machine was already in NEXFS; --force redoes it |
7.1 How many nodes: the edition
Every machine of the cluster counts as a node, whatever its role (compute, storage or terminal). Without a license the cluster is Free and has up to 4 nodes: no license and no registration. To go further:
| Edition | Nodes | How |
|---|---|---|
| Free | up to 4 | nothing to do |
| Trial | up to 128, every module | sudo nex license trial: 30 days, once per cluster |
| Base | up to 32 | yearly license from https://nex.aratoingegneria.it |
| Enterprise | up to 128 (more on request), with the paid modules | yearly license |
nex license shows the edition and the nodes in use:
nex license
Edition Free
Nodes 3 of 4
Cluster sha256:2de81929...
Up to 4 nodes without a license. A 30-day trial (sudo nex license trial) or a Base or
Enterprise license from https://nex.aratoingegneria.it raises the limit.
When the limit is reached, nex-setup add refuses the new node and says why;
the nodes already in the cluster always keep working.
A Base or Enterprise license comes with an activation code. On any node, as root:
sudo nex license activate NEX-XXXX-XXXX-XXXX-XXXX
The cluster gets its license from https://nex.aratoingegneria.it and renews
it by itself every week, as long as the yearly fee is paid. A cluster without
Internet uses nex license request, uploads its output with the code on the
page https://nex.aratoingegneria.it/attiva from a PC with Internet, and
installs the file it gets with sudo nex license import nex-license.json.
Only the fingerprint of the cluster CA, the NEX version and the number of
nodes leave the cluster: no names, addresses or users.
8. Three copies of the data
With three or more storage nodes, ask NEXFS to keep three copies of every block, each on a different node. On node-a:
sudo nexfsctl copies 3
sudo nexfsctl space
You should see "copies": 3. Blocks written from now on get three
copies at once; existing ones are copied in the background ("converting": true until it has finished). The free space shown by df -h /nex already
takes the copies into account: three 1 TB disks with three copies give about
1 TB.
With fewer storage nodes, use as many copies as there are storage nodes.
9. Create the first user
Cluster users have the same name, password and home folder on every node. On any compute node (here node-a):
sudo nexctl users add mario
sudo nexctl users passwd mario # type the password twice (at least 8 characters)
sudo nexctl users apply # right away on this node
Every other compute node picks up the new user within a minute. The home
folder is /nex/home/mario, private to its owner.
To put users in a group (for example for a shared project folder), create the group first, then give it to the user:
sudo nexctl users group-add progetto
sudo nexctl users add anna --groups progetto --ssh-key anna.pub
Check, from another PC on the network:
ssh mario@node-b
touch ~/ciao # on node-b
ssh node-c ls -l ~/ciao # the same file, seen from node-c
nex run --node node-a hostname # a command run on node-a
All the user commands are in the User guide.
10. Open the dashboard
Every node serves a web dashboard at https://NODE:7443 (for example
https://node-a:7443). Root and cluster users log in with their password;
each user sees their own processes and jobs, root sees everything.
The dashboard's certificate is signed by the cluster CA, which your browser does not know yet. To get rid of the warning, once per PC:
- copy the CA certificate (it is public; the private key stays on node-a):
scp admin@node-a:/etc/nex/pki/ca.crt nex-ca.crt - import
nex-ca.crtamong the trusted authorities of the system or of the browser; - open the dashboard by name (
https://node-a:7443), not by address: the certificate carries the node name. The PC must resolve the names (DNS, or its hosts file).
Details in dashboard.md.
11. After the installation: what to keep safe
Remove the passwordless sudo used for the installation, on every node:
sudo rm /etc/sudoers.d/nex-installazione. Put it back only when you add a node.Back up these files outside the cluster, in a safe place:
File Where Why the cluster CA /etc/nex/ca/on node-aneeded to add nodes; gives access to the cluster the block key /etc/nexfs/blocchi.keyon each storage nodewithout it, that node's disk cannot be read (its copies come back from the other nodes) the secrets key /etc/nex/secrets.keywithout it, users' secrets cannot be read Certificates expire. Node certificates last two years, the CA ten.
sudo nexctl pki statusshows the date (not_after).Next steps: cluster services and virtual addresses in Services, Windows access in SMB, and the optional features in §14 (snapshots are already on, backups outside the cluster are not).
Part three: reference
12. Configuration files
/etc/nex/node.json
| Field | Meaning |
|---|---|
node |
node name (letters, digits, ., _, -) |
roles |
compute, storage (one or both) |
storage.type |
the storage of the shared filesystem: nexfs (required with the compute role) |
compute.mount |
shared filesystem (/nex); it may not cover a system folder |
compute.options |
mount options (default noatime; nodev and nosuid are always added) |
compute.binds |
folders of /nex also mounted elsewhere, e.g. [{"source": "data", "target": "/srv/nex-data"}] mounts /nex/data also on /srv/nex-data |
compute.drain_timeout |
seconds, 1-3600 (30 if the key is missing; nex-setup writes 15). When the node detaches (nexctl leave): the services get up to drain_timeout + 60 s to move their instances to other nodes; with --terminate the processes still using /nex get up to drain_timeout seconds after SIGTERM, then --kill sends SIGKILL |
agent.listen, agent.port |
agent address (numeric IPv4) and port (7440) |
agent.peers |
the other nodes, {"node": ..., "addr": ...}: manage them with nexctl agent peer-add NAME --addr ADDR and nexctl agent peer-remove NAME |
The file must belong to root and must not be writable by group or others.
sudo nexctl validate checks it. A storage-only node has no compute
section.
Other files
| File | What |
|---|---|
/etc/nex/pki/ |
node key and certificate, CA certificate (nexctl pki status) |
/etc/nex/ca/ |
the cluster CA: only on the first node |
/etc/nex/secrets.key |
key of nex secret (root, 0600, the same on every compute node) |
/etc/nex/nexsh.conf |
nexsh remotable commands |
/nex/.nex/users.json |
cluster users (nexctl users) |
/var/lib/nex/keys/, /etc/ssh/sshd_config.d/nex.conf |
local copy of the cluster users' public ssh keys, used by sshd (clear message on detached nodes) |
/etc/nexfs/nexfs.json |
the node's NEXFS configuration (nexfsctl); the certificates are those of NEX |
/etc/nexfs/blocchi.key |
block encryption key of a storage node (root, 0600) |
/etc/nex/devnodes.conf |
devices this node exports to the others (/devnodes), see below |
Exported devices: /etc/nex/devnodes.conf
By default a node exports nothing. Each line exports a character device (currently serial ports) and states who may use it:
# NAME PATH WHO
ttyUSB0 /dev/serial/by-id/usb-FTDI_FT232R_A10K1234-if00-port0 mario @laboratorio
console /dev/ttyS0 *
NAME: letters, digits,. _ -; on the other nodes it becomes/devnodes/<this node>/dev/NAME;PATH: preferably the stable names in/dev/serial/by-id/. Not a link in/tmpor in a user's folder: the kernel does not let even root follow it (fs.protected_symlinks) and the device shows as "absent";WHO: users,@groups,*= all non-system users (uid >= 1000); root only if named explicitly.
The file is reread on every request and the other nodes catch up within
10 s (immediately with systemctl kill -s HUP nex-devnodes on them).
nex-devnodes (CUSE) runs on every node: it creates
/dev/nexdev/<node>/<name> (0666, udev rule 60-nex-devnodes.rules) and
the link in /devnodes; the identity of whoever opens it is supplied by
the kernel, and the check is done by the exporting node. Only serial
ioctls pass (termios, modem lines, break, flush, RS-485 read and write);
those that would do more with root permissions (TIOCSSERIAL, TIOCSTI)
do not. nex devices shows the status.
Unix sockets. If PATH is a Unix socket, the line exports the socket.
For example that of a service listening only locally:
redis /run/redis/redis-server.sock @analisi
On the other nodes it appears as /devnodes/<this node>/sock/NAME. Every
connection arrives here, and the agent connects to the socket as the
connecting user, never as root:
- the service sees the real uid (
SO_PEERCRED); - the socket file's permissions apply too, in addition to the
WHOcolumn; - a socket that would give root more power (for example
/run/podman/podman.sockor/var/run/docker.sock) stays useless to anyone who could not use it on the node anyway.
Half-close (shutdown) passes through; descriptors passed with
SCM_RIGHTS do not.
Disks. If PATH is a block device, the line exports a disk. WHO must
contain root: a disk is used by the administrator only, because the
kernel does not say which user opens a block device.
dati /dev/disk/by-id/ata-WDC_WD40EFRX_WD-1234 root
A disk does not attach by itself. On the node that wants to use it:
sudo nexctl disk attach node-b/dati # -> /dev/nbd0 and /devnodes/node-b/disk/dati
sudo mount /devnodes/node-b/disk/dati /mnt/dati
sudo umount /mnt/dati
sudo nexctl disk detach node-b/dati
sudo nexctl disk list
- One node at a time. The disk's node opens it exclusively
(
O_EXCL): a secondattach, from any node, and a local mount while it is attached are refused ("Device or resource busy"). A regular filesystem (ext4, xfs) mounted on two nodes at once would be corrupted; for shared data there is/nex. - How it works. On the attaching node, the kernel sees the disk as
/dev/nbdN(modulenbd).nex-devnodes --diskruns in the unitnex-disk-NODE-NAMEand passes NBD requests through the encrypted channel between the agents; the disk's node performs reads, writes, flush and trim. - Before detaching, unmount:
detachrefuses a mounted disk. - If the disk's node does not respond for 2 minutes, operations in progress end with an I/O error.
- Speed: that of the network and of the disk's node; every request passes through the encrypted channel between the agents.
USB. If PATH is the sysfs folder of a USB device
(/sys/bus/usb/devices/<busid>, for example 1-2 for port 2 of bus 1),
the line exports that device, again with WHO set to root:
chiavetta /sys/bus/usb/devices/1-2 root
sudo nexctl usb attach node-b/chiavetta # appears here as if plugged in here
sudo nexctl usb detach node-b/chiavetta # goes back to node-b with its driver
sudo nexctl usb list
- How it works. It is USB/IP, but without
usbipdlistening on the network. The exporting node binds the device to theusbip-hostdriver, the attaching node sees it on avhci_hcdport, and the USB/IP protocol passes through the encrypted channel between the agents. - One node at a time. While a node is using it, the device is not available on its own node or on others.
- On detach it goes back to its driver on the node where it is physically plugged in.
- The busid depends on the physical port: if the cable is moved, it changes.
USB/IP makes a round trip for every transfer, so it suits instruments, keys,
USB serial adapters and USB sticks, not fast disks (for those there is nexctl disk).
Cluster users
sudo nexctl users group-add progetto # a group must exist before it is used
sudo nexctl users add mario --groups progetto --ssh-key mario.pub
sudo nexctl users passwd mario
sudo nexctl users list
Every compute node applies them within a minute (nex-users.timer), or at
once with sudo nexctl users apply. Home folders in /nex/home are private
(0700) and applying resets them to 0700 if someone opens them, including
those of removed users: to share files, use project folders with a group.
Other actions: keys, lock, unlock, remove, groups, group-remove,
quota (nexctl --help).
13. Storage nodes: status, maintenance, removal
A node with the storage role holds the cluster's data on NEXFS. It is added
with nex-setup --roles storage --disk DIR (§7), live: new blocks use it
immediately, existing ones are rebalanced in the background. The number of
copies is chosen with nexfsctl copies (§8).
From the first node:
sudo nexctl storage status --host node-c # data node and meta node, health
sudo nexctl storage maintenance-enter --host node-c # a short stop (upgrade, reboot)
sudo nexctl storage maintenance-exit --host node-c
sudo nexctl storage drain-check --host node-c # can it be removed?
sudo nexctl storage drain --host node-c # empties it, then lists the final steps
In maintenance the cluster does not recreate the node's copies elsewhere, and a meta node stops voting, so the others do not wait for it.
Removing a storage node for good:
sudo nexctl storage drain --host node-con the first node: the node leaves the meta nodes and its blocks move to the others, until "drained" (up to half an hour). It is refused if the remaining nodes do not have enough room or are fewer than the copies (lower them first withnexfsctl copies).- The answer lists the last steps, with the right node number:
- on node-c:
sudo systemctl disable --now nexfsd - on the first node:
sudo nexfsctl node forget ID - on node-c:
sudo nex-setup remove --from node-a(§17)
- on node-c:
One more disk for a storage node. A node holds up to 16 disks for the data. With the new disk in the machine, on the node itself:
sudo nexctl storage disk-list # the disks: the cluster's, the empty ones, the others
sudo nexctl storage disk-add sdc # asks to type sdc to confirm
disk-add takes only an empty disk (it never formats a disk with something
on it: empty it by hand with wipefs). It formats it, mounts it on
/srv/nexfs/discoN from /etc/fstab with its UUID and nofail, adds it to
NEXFS and restarts nexfsd in an orderly way: the node stays in the cluster.
The data written from then on go to the disk with the most free space; what
is already there stays where it is, so the node has no extra work while it
serves the cluster. The same from NEX Setup, on the node already set up:
Add a disk.
14. Optional services and features
Web dashboard
nex-dashd (enabled by nex-setup) serves https://NODE:7443 on every
node, read-only, with the node certificate signed by the cluster CA. For
users' browsers:
- import the cluster CA once (
/etc/nex/pki/ca.crtfrom any node) into the trusted authorities of the system or browser; - make node names resolvable (DNS or hosts file): the certificate carries
the node name (
DNS:node-a), not the IP address; - open port 7443/tcp towards the users' network, if there is a firewall.
Root and the cluster users log in with their password; everyone sees
their own processes and jobs, root sees everything. Address and port are
changed with a drop-in for the unit (nex-dashd --listen IP --port PORT).
Details in nex-dashd(8) and, for users, dashboard.md.
Access from Windows PCs
On every compute node that must serve the PCs:
sudo apt install --no-install-recommends samba
sudo nexctl smb enable
then, once, a virtual address with sudo nex vip add smb ADDRESS --port 445.
Users enable access with nex passwd. Everything else, project folders
included, in smb.md.
Printers
On two or three compute nodes that will serve printing:
sudo nex apt install cups --nodes node-a,node-b
sudo nexctl print enable --ip ADDRESS/PREFIX # on the first: the address of print.nex
sudo nexctl print enable # on the others
sudo nexctl print add office --uri ipp://PRINTER-ADDRESS/ipp/print
Within a minute every node prints on the printers of the cluster.
Permissions, announcement to the PCs and everything else in
stampa.md.
Scanners are added the same way with nexctl scan add (network or USB) or
nexctl scan share (SANE scanners of a node): section 9 of
stampa.md.
Snapshots and backups
Snapshots (always on). Every hour the services leader takes a
snapshot of every protected folder: by default every subfolder of
/nex/home and of /nex/progetti. A snapshot is instantaneous and takes
up only the blocks changed afterwards. The last 24 are kept, plus the last
one of each of the last 14 days and of the last 8 weeks. Users recover
files by themselves (nex snapshot restore, see the user guide) and
create manual ones of their own home (at most 10 per folder).
nex snapshot config # rules, and which folders are protected right now
sudo nex snapshot set dirs 'home/*,progetti/*,data'
sudo nex snapshot set hourly 48 # 0 for hourly, daily and weekly = automatic ones off
Backups outside the cluster (optional). Snapshots live inside the
cluster: they protect against mistakes, not against the loss of the whole
cluster (fire, theft, administration error). The backup copies the
protected folders to another server with rsync over SSH. As long as
backup_target is empty nothing runs. The server only needs a user with
SSH and rsync:
# on the backup server
useradd -m nexbk && install -d -o nexbk /srv/nexbackup
# on a compute node of the cluster
sudo nex backup key # creates the key (one for the cluster) and prints the public one:
# it goes into ~nexbk/.ssh/authorized_keys on the server
sudo nex backup set backup_target nexbk@backup.esempio.it:/srv/nexbackup
sudo nex backup run # the first copy right away; then every night at 01:30
sudo nex backup status
Each copy is a complete folder /srv/nexbackup/YYYY-MM-DD_HHMM/
(home/mario/..., progetti/...). Files identical to the previous copy
are hard links, so each copy only takes up the differences. backup_keep
copies are kept (7). The copy is made from a snapshot, so it is consistent
even with files open for writing. It runs on the current leader, one at a
time across the whole cluster (a lock in the control store). If it fails,
nex backup status exits with 3 and the backup alarm appears.
The remote host is accepted on the first connection: its key is kept in
/nex/.nex/backup/known_hosts. If it changes later, the backup stops.
Restoring from a backup: it is an ordinary file copy, for example
rsync -aH nexbk@backup:/srv/nexbackup/2026-10-06_0130/home/mario/ /nex/home/mario/.
Accounting and audit
Always on, no configuration needed.
Usage (
nex acct):- jobs: at the end of a job systemd measures CPU, peak memory and duration. Root writes them, so the user cannot alter them;
- interactive sessions: sampled every minute from the
user-UID.sliceslices (SSH or graphical login). A session that starts and ends between two rounds (less than a minute) may be missed. Whatever is launched withsuorsudoinside someone else's session counts towards the session of whoever opened it; - space: home and project folders, measured once a day by the leader
with the NEXFS recursive count (
nexfs.dir.rbytes).
The data is kept in the control store by day (
acct.YYYYMMDD) for 400 days.Audit (
nex audit): start and end of every job (user, node, command, folder, via:run,run -d, queue,cron:NOME,service:NOME; exit code, duration, CPU, memory) and the actions taken through the agent: services, cron, images, tokens, snapshots and backups, alarms (withvia=apiif they come from the API). It is kept in the control store by day (audit.YYYYMMDD) for 365 days.nexctlactions (users, nodes) remain in each node's journal.
nex acct --from 2026-09-01 --to 2026-09-30 # root: all users
nex acct --user mario --json
nex audit --since 7d --user mario --type job.start
The same data, in JSON, from the API: GET /api/v1/acct and GET /api/v1/audit.
Job containers
With Podman on the compute nodes, users can run jobs, scheduled tasks and
services in a fixed environment: nex run --image IMAGE. Every
container runs rootless, as the real cluster user, with /nex mounted
at the same path, the node's network and the job's --cpu and --mem
limits.
sudo apt install podman uidmap fuse-overlayfs catatonit # on every compute node
NEX does not touch /etc/containers: it uses its own configuration, which
the agent writes at startup into /etc/nex/containers/, valid only for job
containers. nexctl users apply writes the cluster users' ranges into
/etc/subuid and /etc/subgid (65536 ids each, the same on all nodes),
without touching the other lines.
Images live in a single store on /nex/.nex-images, written only by root
and read by all nodes. Root pulls them, from the allowed registries
(by default docker.io and quay.io):
nex image registries docker.io,quay.io,registry.azienda.it:5000
nex image pull docker.io/library/debian:13 # full name, including the registry
nex image list
nex image remove docker.io/library/debian:13
A job never pulls anything (--pull=never): it only uses the images in
the store. Each container's writable layer is on the local disk, in
/var/tmp/nex-containers/UID/UNITA, and the agent removes it when the job
has finished.
Alarms
Alarms work out of the box, without configuration: the services leader
(one compute node at a time) checks nodes, disks, /nex, memory and the
storage (NEXFS) every 30 seconds, and keeps alarms, history (7 days) and
thresholds in the control store (tables alarm, alarm.log,
alarm.conf): if the leader goes down, its successor picks up from the
same alarms without repeating the notifications.
| Alarm | When | Level |
|---|---|---|
node:NODE |
the node has not responded for node_down_s seconds (60) |
critical |
disk:NODE:MOUNT, nexfs |
disk or /nex above disk_warn / disk_crit (85 / 95 %) |
warning / critical |
mem:NODE |
memory used above mem_warn / mem_crit (90 / 97 %) |
warning / critical |
storage |
nexfsctl health reports warning (a node not responding, copies to be redone, a node in maintenance) or error (no majority, no data node), or NEXFS does not respond |
warning / critical |
license |
the cluster has more nodes than its edition allows (they keep working, new nodes cannot join), the license is not valid or has expired, or the license or the trial ends within 7 days (nex license) |
warning |
An alarm is raised after repeat consecutive checks over the threshold
(2) and clears when the value drops hysteresis points (5) below it: a
disk hovering around 85 % does not send a notification every minute.
nex alarm config # thresholds and recipients
nex alarm set disk_warn 80 # (root) applies to the whole cluster
nex alarm set notify_users root,mario # terminals notified (default: root)
nex alarm set email_to it@esempio.it # email, via /usr/sbin/sendmail
nex alarm ack nexfs # (root) acknowledged: stays, marked
nex alarm test # (root) test alarm: checks the notifications
Notifications are sent only on changes (new, worsened, eased, cleared) and go:
- to the terminals of the
notify_usersusers, on all nodes, likenex msg; - by email to
email_to, if/usr/sbin/sendmailis present (for example themsmtp-mtapackage configured towards the company mail server); senderemail_from, defaultnex@NODE; - to the script
/etc/nex/alarm-notify, if present, with the alarm as JSON on standard input (fieldsid,level1 or 2,message,event,since,node,reported_by). It runs as root, so it is used only if it is owned by root, executable and not writable by group and others; it must be placed on every compute node (the current leader runs it). Example towards a chat channel:
#!/bin/sh
# /etc/nex/alarm-notify (chmod 0755, owned by root)
jq -r '"\(.event): \(.message)"' | curl -s -d @- https://chat.esempio.it/hook/XYZ
Secrets key (nex secret)
Users' secrets (nex secret) are encrypted with a cluster key,
/etc/nex/secrets.key (root, 0600), which must be the same on every
compute node. It is created only once, on the first node (§6.4), and
nex-setup copies it to every compute node added afterwards. If it was
created after some nodes had already joined, copy it to them from the first
node:
sudo cat /etc/nex/secrets.key | ssh NODE 'sudo install -m 600 -o root /dev/stdin /etc/nex/secrets.key'
sudo nexctl secrets status # fingerprint on every node; to_fix = 0 when all are aligned
- Never regenerate it: secrets already saved would become unreadable.
initrefuses if the key already exists. - Permissions: with permissions other than 0600 the node does not use it.
- Keep it outside the cluster: save a copy in a safe place. A copy of the control store, without the key, is not enough to read the secrets.
Shared software: /nex/opt and modules
A program installed in /nex/opt is installed only once and used from
every node, with Lmod environment modules (module avail,
module load), as on computing clusters.
# on every compute node (the nex-cluster package already has /etc/profile.d/00-nex-modules.sh)
sudo apt install lmod
# only once, from a compute node
sudo nexctl software init # /nex/opt and /nex/opt/modulefiles, owned by root
sudo nexctl software init --group software # or: members of the "software" group install without root
# install a program and its module
./configure --prefix=/nex/opt/gromacs/2025.1 && make && make install
nexctl software add gromacs/2025.1 --prefix /nex/opt/gromacs/2025.1 --description "dinamica molecolare"
nexctl software list
- The modulefile (
/nex/opt/modulefiles/gromacs/2025.1.lua) is written byadd: PATH, LD_LIBRARY_PATH, MANPATH, PKG_CONFIG_PATH and CPATH for the subfolders that exist, plusGROMACS_ROOT. It can be edited by hand (it is Lua, the Lmod syntax). - On the other nodes:
nex run,nex submitand nexsh'son NODEcarry the variables of the loaded modules, so the program finds its libraries there too (not in--imagecontainers, which have their own). removeremoves only the modulefile: deleting the software is up to you.
Cluster APT package cache
With many nodes, every update downloads the same packages from the
Internet many times. The cluster cache downloads them only once: it is
apt-cacher-ng running as a NEX service, with a virtual address
(aptcache.nex) that follows it if the node goes down, and the cache on
/nex.
sudo apt install apt-cacher-ng # on every compute node
sudo nexctl aptcache enable --ip 10.20.0.50/24 # a free address on the nodes' network
sudo nexctl aptcache status # reachable, cache size
sudo nexctl aptcache disable # turns it off (the cache stays on /nex)
- What
enabledoes:- creates the cluster user
nex-apt(NEX services never run as root) and the folders/nex/.nex-aptcache/{conf,cache,log}; - starts the
aptcacheservice and theaptcachevirtual address; - turns off the distribution's apt-cacher-ng service, which would occupy the same port (3142).
- creates the cluster user
- On the nodes: within a minute every node has
/etc/apt/apt.conf.d/01nex-aptcache. APT asksnex-apt-proxywhich proxy to use: if the cache answers within half a second it goes through it, otherwise it goes direct, so APT never stalls because of the cache. - http only:
http://repositories go through the cache;https://ones go direct.
If the node running the cache goes into maintenance, the cache moves to another compute node in about 15 seconds.
Encryption of traffic and disks
Traffic for /nex and the control state is always encrypted: all
NEXFS connections (clients, meta nodes, data nodes) and agent connections
use mutual TLS 1.3, with certificates from the cluster CA. There is
nothing to turn on: nexctl encryption status confirms it, and also tells
whether the disks of that node are encrypted.
The disks of storage nodes are encrypted too (AES-256-XTS), each with
its own block key (64 random bytes in /etc/nexfs/blocchi.key, owned by
root, 0600): you create it on the first node (§6.3), nex-setup and the
first boot of the images create it on the others. The key is kept off the
disks it protects: a disk removed from a server reveals nothing of what it
held. Keep a backup of the key outside the cluster: without it the node's
blocks can no longer be read, and their copies come from the other nodes.
Details in the NEXFS "Security" guide.
15. Checking a node
sudo nex-setup status # configuration, services, nodes
nex nodes # all nodes: ok, compute, mount
sudo nexctl status # attachment of /nex and of the binds (compute nodes)
sudo nexctl pki status # certificate valid, signed by the CA, expiry date
sudo nexctl encryption status # traffic and disks encrypted
sudo nexfsctl health # the storage: "status": "ok"
journalctl -u nexagentd # startup, TLS rejections, peers reloaded
16. Upgrading
One node
From the repository, sudo apt update && sudo apt upgrade; from files:
sudo apt install ./nexfs*.deb ./libnexfs0_*.deb ./nex-cluster_*.deb ./libnex0_*.deb
- the agent restarts with the new program;
nex runjobs going through this agent at that moment are interrupted; - the attachment is untouched:
/nexstays mounted and users' processes carry on; - configuration, certificates and users are kept.
The whole cluster, without interruptions: nexctl upgrade
As root on a compute node, with a single command, one node at a time. From the repository:
sudo nexctl upgrade --apt --dry-run # first the order, without touching anything
sudo nexctl upgrade --apt
From files, put them in /nex/.nex/pkg and pass each one with --deb
(here version 1.0.0~beta1; on Ubuntu the file names carry ~ubuntu26.04):
sudo install -d -m 0700 /nex/.nex/pkg
sudo cp nexfs*_1.0.0~beta1_amd64.deb libnexfs0_1.0.0~beta1_amd64.deb nex-cluster_1.0.0~beta1_amd64.deb \
libnex0_1.0.0~beta1_amd64.deb /nex/.nex/pkg/
F=$(for f in /nex/.nex/pkg/*_1.0.0~beta1_amd64.deb; do printf -- '--deb %s ' "$f"; done) # one --deb per package
sudo nexctl upgrade $F --expect-version 1.0.0~beta1 --dry-run
sudo nexctl upgrade $F --expect-version 1.0.0~beta1
Pass all the NEXFS files (nexfs, nexfs-server, nexfs-client,
nexfs-tools, libnexfs0): if one is missing, apt-get on the first node
stops before changing anything and the round stops there.
For each node, the others first and the services leader last:
- drain: services and virtual addresses move to the other nodes and the queue gives it no new jobs;
- upgrade: on the node, in its own unit (
nex-upgrade), so that the agent restart does not interrupt it; log in/var/log/nex-upgrade.log; - check: the agent restarted with the expected version and
/nexmounted; - undrain and wait until the services are as healthy as before the drain (up to 3 minutes), so that a service with one replica per node never ends up without healthy instances;
- storage whole again: every NEXFS metadata and data node answers and no block is missing a copy; only then does it move on to the next node.
Before starting, all nodes must respond and there must be no critical
alarm. At the first error the round stops, and the node stays drained
until you check it (nex service undrain NODE). Users' jobs carry on:
detached ones do not depend on the agent, attached ones going through
that node's agent are interrupted.
--apt: upgrades from the repository the NEX packages already installed (nex-cluster,libnex0,libnex-dev,nex-desktop) andnexfswith its parts.--script FILE: runs a root script in/nex/.nex/pkg(for special installations).--nodes A,Blimits the round to some nodes;--timeout Sis the time allowed per node (default 900).- Storage-only nodes: they do not mount
/nex, so the files of--deband--scriptreach them through the agent, checked with SHA-256, and the upgrade runs there like on the other nodes. - One round at a time: only one can run in the whole cluster (a lock in the control store).
The whole system of every node: nex apt
All the machines of the cluster are updated together with a single
command, as root on any node (nex apt and nexctl apt are the same):
sudo nex apt update # apt-get update on every node at the same time
sudo nex apt status # pending updates and reboots, node by node
sudo nex apt upgrade --reboot # the whole system, one node at a time
sudo nex apt install gfortran cmake # the same packages on every compute node
nex apt status reads the package lists already downloaded and changes
nothing:
NODE ROLE UPGRADABLE SECURITY REBOOT LISTS
node-a compute 5 5 no 2 h ago
node-b compute 5 5 no 2 h ago
node-c storage 5 5 no 2 h ago
15 updates pending (15 security): sudo nex apt upgrade
nex apt upgraderunsapt-get updateandapt-get upgrade --with-new-pkgs(new dependencies such as a new kernel are installed, nothing is ever removed) with the same round asnexctl upgrade: drain, upgrade, check, undrain, storage whole again. Storage-only nodes are included.--reboot: a node that asks for a reboot after the upgrade (a new kernel or C library writes/run/reboot-required) is rebooted while still drained, and the round waits for it to come back with its agent and/nexbefore the undrain. The node you run the command from is never rebooted: the answer says so, and you reboot it from another node withsudo nex apt upgrade --reboot --nodes NODE. Without--reboot,nex apt statusshows which nodes need it.nex apt installinstalls on every compute node, where the programs run, so that compilers and libraries are the same everywhere;--nodes A,Bchooses the nodes (also storage-only ones). No drain is needed.--nodes A,B,--timeout Sand--dry-runwork as withnexctl upgrade;nex apttakes the same cluster lock, so only one round runs at a time. The log of each node is in/var/log/nex-upgrade.log; the audit log records every start (nex audit --type pkg.).
Moving to a new Debian or Ubuntu release: the repository will have a new
distribution name; change the Suites: line in
/etc/apt/sources.list.d/nex.sources when you upgrade the system.
17. Removing a node
Remove a node with nex-setup remove before uninstalling: it stops the
services, removes the node from the other nodes' peers, deletes the node's
keys and NEXFS client configuration, and renames node.json to
node.json.removed. A storage node is first emptied and taken out of NEXFS
(§13); until then nex-setup remove refuses.
sudo nex-setup remove --from node-a # detaches, removes the node from the others' peers
sudo apt remove nex-cluster # removes the programs
sudo apt purge nex-cluster # also removes the node's configuration and keys
apt remove alone does not notify the other nodes: they will show the node
as unreachable. Fix it with sudo nexctl agent peer-remove NODE on each of
them. purge never deletes the cluster CA (/etc/nex/ca): remove it by
hand only if the cluster no longer exists.
18. Troubleshooting
| Message | Cause | Remedy |
|---|---|---|
nex-setup must be run as root |
run without sudo | sudo nex-setup ... |
ssh <node>: Permission denied |
the ssh key of this node is missing on the other node | ssh-copy-id <node>, or ssh -A and --preserve-env=SSH_AUTH_SOCK |
sudo: a password is required |
sudo with password on the other node | passwordless sudo for the administrator during the installation (§4.3) |
... is already in the cluster with address ... |
name already in use | another name, or --force to replace it |
nexctl not found: install the nex-cluster package first |
packages missing | §5 |
nexagentd does not start |
node.json or the certificate is missing |
sudo nexctl validate, sudo nexctl pki status |
users init needs /nex mounted |
/nex not mounted yet |
findmnt /nex, journalctl -u nex-compute |
user X is in unknown group Y |
the group does not exist yet | sudo nexctl users group-add Y first |
a node unreachable in nex nodes |
network, port 7440, agent stopped | systemctl status nexagentd on that node |
/nex not mounted |
meta nodes unreachable (port 7400), NEXFS configuration | journalctl -u nex-compute -u 'nexfs-client@*', sudo nexfsctl health |
| browser warning on the dashboard | the cluster CA is not imported, or the page was opened by address | §10 |
Reporting a problem: nex report
When something does not work and you want to report it, attach the
archive made by nex report:
sudo nex report # writes nex-report-<node>-<date>.tar.gz in the current folder
sudo nex report --since 3d -o /tmp/report.tar.gz
tar tzf nex-report-*.tar.gz # what it contains
It collects, read only, the versions of programs, packages and kernel; the
state of nodes, compute role, NEXFS, services, virtual addresses, alarms,
queue, space and memory and pending updates; the warnings and errors of all
nodes and the logs of the agent and of NEXFS since --since (default 24
hours); the configuration of this node; subject, issuer and expiry of the
certificates.
It never contains private keys, the NEXFS block key, the nex secret key,
tokens or passwords: of the configuration only files readable by everyone
are taken (secrets are 0600), and the values of fields named like key,
secret, password or token become "(hidden)". The archive is 0600 and,
with sudo, belongs to the user who asked for it. As a normal user the
report is reduced (your own logs only, no state of the node) and says so.
19. What the packages contain
NEX and NEXFS are entirely compiled in C: no interpreter is required.
| Path | What |
|---|---|
/usr/sbin/nexagentd |
node agent |
/usr/sbin/nexctl |
node lifecycle, PKI, cluster users, peers |
/usr/sbin/nex-setup |
adding and removing the node from a cluster |
/usr/bin/nex, nxps, nxtop, nxfree, nxdf, nxnodes, nxcpu, nxnet, nxss |
nex command |
/usr/bin/nexsh |
NEX shell |
/usr/libexec/nex/ |
nex-exec, nex-hold (keeper of detached jobs), nex-login-check |
/usr/lib/x86_64-linux-gnu/libnex.so.0 |
library for applications (package libnex0; header and link for compiling in libnex-dev) |
/usr/sbin/nexfsd, nexfsctl, nexfs-client |
NEXFS (packages nexfs-server, nexfs-tools, nexfs-client, brought by nexfs) |
/usr/share/man/ |
manual pages (in English; in Italian under it/): nex(1), nexsh(1), nexctl(8), nex-setup(8), nexagentd(8), nex-dashd(8), nex-devnodes(8); nex-desktop(1) and nex-monitor(1) (package nex-desktop); nex(3) (package libnex-dev); and those of NEXFS |
/etc/ssh/sshd_config.d/nex.conf |
ssh keys of cluster users, also as a local copy |
/usr/lib/systemd/system/ |
nexagentd, nex-compute, nex-users (service and timer), nex-devnodes, nex-dashd; nexfsd, nexfs-client@ |
/usr/share/pam-configs/nex |
rejection of cluster users on detached nodes |
/etc/nex/nexsh.conf |
nexsh remotable commands (configuration file) |
Building the packages from source (on a Debian or Ubuntu machine with
debhelper and the libnexfs-dev package installed, which provides the
header and the link of the library):
git clone --recurse-submodules <repository NEX> && cd NEX
dpkg-buildpackage -us -uc -b # creates ../nex-cluster_*.deb, ../libnex0_*.deb, ../libnex-dev_*.deb
lintian ../*_<versione>_amd64.deb
Installing without a package (development): make STORAGE=nexfs && sudo make install
(into /usr/local).