MODOP – Mise en place d’une infrastructure IPFS décentralisée et hautement disponible sur réseau public – Partie 1

1. Inventaire du Cluster

Hostname

  • Node-ipfsl : IP = 192.168.1.70 (leader)
  • Node-ipfsp1 : IP = 192.168.1.71 (peer n°1)
  • Node-ipfsp2 : IP = 192.168.1.72 (peer n°2)

HDD

  • Disque SCSI0 : Système
  • Disque SCSI1 & SCSI2 : RAID1

2. Installation des prérequis (3 nœuds)

Update machine

[root@node-ipfsx ~]# dnf -y update

Desactiver SELinux 

[root@node-ipfsx ~]# setenforce 0
[root@node-ipfsx ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@node-ipfsx ~]# getenforce
Permissive

Paramétrage ntp 

[root@node-ipfsx ~]# timedatectl set-timezone Europe/Paris
[root@node-ipfsx ~]# timedatectl

Installation paquets utils

[root@node-ipfsx ~]# dnf install epel-release net-tools nmap wget tar -y

3. Configuration RAID1 (3 nœuds)

Inventaire des disques

[root@node-ipfsx ~]# lsblk

Installation du paquet RAID Logiciel

[root@node-ipfsx ~]# yum -y install mdadm

Chargement des modules RAID

[root@node-ipfsx ~]# modprobe linear
[root@node-ipfsx ~]# modprobe raid1
[root@node-ipfsx ~]# cat /proc/mdstat

Chargement des modules RAID (On Boot)

[root@node-ipfsx ~]# echo "modprobe linear" >> /etc/rc.local
[root@node-ipfsx ~]# echo "modprobe raid1" >> /etc/rc.local
[root@node-ipfsx ~]# chmod +x /etc/rc.local

Examen des volumes disques

[root@node-ipfsx ~]# mdadm -E /dev/sd[b-c]
mdadm: No md superblock detected on /dev/sdb.
mdadm: No md superblock detected on /dev/sdc.

Partitionnement des disques en mode RAID

Disque /dev/sdb

[root@node-ipfsx ~]# parted -s /dev/sdb mklabel msdos
[root@node-ipfsx ~]# parted -s /dev/sdb mkpart primary 1MiB 100%
[root@node-ipfsx ~]# parted -s /dev/sdb set 1 raid on

Disque /dev/sdc

[root@node-ipfsx ~]# parted -s /dev/sdc mklabel msdos
[root@node-ipfsx ~]# parted -s /dev/sdc mkpart primary 1MiB 100%
[root@node-ipfsx ~]# parted -s /dev/sdc set 1 raid on

[root@node-ipfsx ~]# fdisk -l /dev/sd[b-c] |grep RAID

Création du RAID 1 

Inventaire des deux disques

[root@node-ipfsx ~]# mdadm -E /dev/sd[b-c]

Création RAID 

[root@node-ipfsx ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

[root@node-ipfsx ~]# watch -n1 cat /proc/mdstat

Inventaire des disques RAID

[root@node-ipfsx ~]# lsblk

4. Préparation du Volume RAID (3 machines)

Formatage sur disque Raid1

[root@node-ipfsx ~]# mkfs.ext4 /dev/md0

Création du Volume IPFS

[root@node-ipfsx ~]# mkdir -p /mnt/ipfs-data

Montage du Volume IPFS

[root@node-ipfsx ~]# echo "/dev/md0 /mnt/ipfs-data ext4 defaults 0 2" >> /etc/fstab
[root@node-ipfsx ~]# systemctl daemon-reload
[root@node-ipfsx ~]# mount -a

[root@node-ipfsx ~]# df -h |grep ipfs

5. Installer et configure GO (3 machines)

[root@node-ipfsx ~]# cd /home
[root@node-ipfsx home]# wget https://go.dev/dl/go1.24.4.linux-amd64.tar.gz
[root@node-ipfsx home]# tar -xvf go1.24.4.linux-amd64.tar.gz
[root@node-ipfsx home]# mv go /usr/local

[root@node-ipfsx home]# mkdir $HOME/gopath
[root@node-ipfsx home]# vi $HOME/.bashrc
#export PATH
export GOROOT=/usr/local/go
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

[root@node-ipfsx home]# source ~/.bashrc
[root@node-ipfsx home]# go version

6. Règles firewall peer client (3 machines)

  • 4001 TCP Connexions entrantes (swarm IPFS)
  • 5001 TCP (optionnel) API IPFS (utile pour le contrôle à distance)
  • 8080 TCP (optionnel) Passerelle HTTP (consultation via navigateur)
  • 9094 TCP IPFS Cluster
  • 9096 TCP Communications internes entre pairs du cluster
[root@node-ipfsx ~]# firewall-cmd --add-port={4001,5001,9094,9095,9096}/tcp --permanent
[root@node-ipfsx ~]# firewall-cmd --add-port=4001/udp --permanent
[root@node-ipfsx ~]# firewall-cmd --remove-service={cockpit,dhcpv6-client} --permanent
[root@node-ipfsx ~]# firewall-cmd --reload
[root@node-ipfsx ~]# firewall-cmd --list-all

7. Installation Kubo (go-ipfs) – IPFS (3 machines)

  • https://dist.ipfs.tech/kubo/v0.35.0/

[root@node-ipfsx ~]# cd /home
[root@node-ipfsx home]# wget https://dist.ipfs.tech/kubo/v0.35.0/kubo_v0.35.0_linux-amd64.tar.gz
[root@node-ipfsx home]# tar -xzvf kubo_v0.35.0_linux-amd64.tar.gz kubo/

[root@node-ipfsx home]# cd kubo && bash install.sh && cd ..
[root@node-ipfsx home]# ipfs --version
ipfs version 0.35.0

8. Installation Cluster IPFS (3 machines)

Installation paquet Cluster service

[root@node-ipfsx home]# cd /home && wget https://dist.ipfs.tech/ipfs-cluster-service/v1.1.4/ipfs-cluster-service_v1.1.4_linux-amd64.tar.gz
[root@node-ipfsx home]# tar -xzvf ipfs-cluster-service_v1.1.4_linux-amd64.tar.gz ipfs-cluster-service/

[root@node-ipfsx home]# mv ipfs-cluster-service/ipfs-cluster-service /usr/local/bin/
[root@node-ipfsx home]# ipfs-cluster-service --version
ipfs-cluster-service version 1.1.4

Installation paquet Cluster ctl

[root@node-ipfsx home]# cd /home && wget https://dist.ipfs.tech/ipfs-cluster-ctl/v1.1.4/ipfs-cluster-ctl_v1.1.4_linux-amd64.tar.gz
[root@node-ipfsx home]# tar -xzvf ipfs-cluster-ctl_v1.1.4_linux-amd64.tar.gz ipfs-cluster-ctl/

[root@node-ipfsx home]# mv ipfs-cluster-ctl/ipfs-cluster-ctl /usr/local/bin/
[root@node-ipfsx home]# ipfs-cluster-ctl --version
ipfs-cluster-ctl version 1.1.4

9. Initialisation et Service IPFS (go-ipfs) (3 machines)

Définition variable IPFS fichier configuration

[root@node-ipfsx home]# export IPFS_PATH=/mnt/ipfs-data/ipfs
[root@node-ipfsx home]# vi $HOME/.bashrc

[root@node-ipfsx home]# source $HOME/.bashrc
[root@node-ipfsx home]# echo $IPFS_PATH
/mnt/ipfs-data/ipfs

10. Initialisation ipfs des 3 machines

Initialisation & réglages Système Node-ipfsl (leader)

Initialisation ipfs

[root@node-ipfsl home]# ipfs init
generating ED25519 keypair...done
peer identity: 12D3KooWCWwgEQx51YWB54Fn82JVQJ1SNm52sTHmNtQQAvMr6yza
initializing IPFS node at /mnt/ipfs-data/ipfs

Réglage système

[root@node-ipfsl home]# ipfs config --json Datastore.StorageMax '"40GB"'
[root@node-ipfsl home]# ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
[root@node-ipfsl home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
[root@node-ipfsl home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
[root@node-ipfsl home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://192.168.1.70:5001", "http://localhost:3000", "http://127.0.0.1:5001", "https://node-ipfsl.house.cp"]'

Initialisation Node-ipfsp1& réglages Système (peer n°1)

Initialisation ipfs

[root@node-ipfsp1 home]# ipfs init
generating ED25519 keypair...done
peer identity: 12D3KooWJb4HwVbXFuxZSeFAUjocurt7gPw14G6CsZRwTpVgMNdP
initializing IPFS node at /mnt/ipfs-data/ipfs

Réglage système

[root@node-ipfsp1 home]# ipfs config --json Datastore.StorageMax '"40GB"'
[root@node-ipfsp1 home]# ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
[root@node-ipfsp1 home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
[root@node-ipfsp1 home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
[root@node-ipfsl home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://192.168.1.71:5001", "http://localhost:3000", "http://127.0.0.1:5001", "https://node-ipfsp1.house.cp"]'

Initialisation Node-ipfsp1 & réglages Système (peer n°2)

Initialisation ipfs

[root@node-ipfsp2 home]# ipfs init
generating ED25519 keypair...done
peer identity: 12D3KooWQ4VuBLMjVvmW4F4fhKxbArFG4Y9SQ3coVBo1PL29qrJx
initializing IPFS node at /mnt/ipfs-data/ipfs

Réglage système

[root@node-ipfsp2 home]# ipfs config --json Datastore.StorageMax '"40GB"'
[root@node-ipfsp2 home]# ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
[root@node-ipfsp2 home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
[root@node-ipfsp2 home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
[root@node-ipfs2 home]# ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://192.168.1.72:5001", "http://localhost:3000", "http://127.0.0.1:5001", "https://node-ipfsp2.house.cp"]'

11. Configuration Service daemon ipfs (3 machines)

Création du service

[root@node-ipfsx home]# vi /etc/systemd/system/ipfs-peer.service

[Unit]
Description=IPFS Node (Pair – stockage RAID1)
After=network.target

[Service]
User=root
Environment="IPFS_PATH=/mnt/ipfs-data/ipfs"
ExecStart=/usr/local/bin/ipfs daemon
Restart=on-failure
LimitNOFILE=10240

[Install]
WantedBy=multi-user.target

Démarrage du service

[root@node-ipfsx home]# systemctl daemon-reexec
[root@node-ipfsx home]# systemctl daemon-reload
[root@node-ipfsx home]# systemctl enable ipfs-peer
Created symlink /etc/systemd/system/multi-user.target.wants/ipfs-peer.service → /etc/systemd/system/ipfs-peer.service.
[root@node-ipfsx home]# systemctl start ipfs-peer

Check du service Node-ipfsl (leader)

[root@node-ipfsl home]# systemctl status ipfs-peer

Check du service Node-ipfsp1 (peer n°1)

[root@node-ipfsp1 home]# systemctl status ipfs-peer

Check du service Node-ipfsp2 (peer n°2)

[root@node-ipfsp2 home]# systemctl status ipfs-peer

12. Initialisation et Service Cluster IPFS (3 machines)

Définition variable IPFS fichier configuration Cluster

[root@node-ipfsx home]# export IPFS_CLUSTER_PATH=/mnt/ipfs-data/ipfs-cluster
[root@node-ipfsx home]# vi $HOME/.bashrc

[root@node-ipfsx home]# source $HOME/.bashrc
[root@node-ipfsx home]# echo $IPFS_CLUSTER_PATH
/mnt/ipfs-data/ipfs-cluster 

Initialisation cluster

[root@node-ipfsx home]# ipfs-cluster-service init
2025-07-12T13:25:21.695+0200 INFO config config/config.go:482 Saving configuration
configuration written to /mnt/ipfs-data/ipfs-cluster/service.json.
2025-07-12T13:25:21.697+0200 INFO config config/identity.go:73 Saving identity
new identity written to /mnt/ipfs-data/ipfs-cluster/identity.json
new empty peerstore written to /mnt/ipfs-data/ipfs-cluster/peerstore.

Node-ipfsl (leader)

Récupération la clef secrète du leader

[root@node-ipfsl home]# cat /mnt/ipfs-data/ipfs-cluster/service.json |grep -i secret
 "secret": "9dc28eb1c943ec508cc9f5a8b4c4726a5398be979c62521dd93252d62cb72196",

Injection de la clef secrète dans les peers client

Node-ipfsp1 (peer n°1)

[root@node-ipfsp1 home]# vi /mnt/ipfs-data/ipfs-cluster/service.json

Node-ipfsp2 (peer n°2)

[root@node-ipfsp2 home]# vi /mnt/ipfs-data/ipfs-cluster/service.json

Création des services Leader et peers

Service Node-ipfsl (leader)

[root@node-ipfsl home]# vi /etc/systemd/system/ipfs-cluster.service

[Unit]
Description=IPFS Cluster Service (RAID1)
After=network.target

[Service]
User=root
Group=root
Environment=IPFS_CLUSTER_PATH=/mnt/ipfs-data/ipfs-cluster
ExecStart=/usr/local/bin/ipfs-cluster-service daemon
WorkingDirectory=/mnt/ipfs-data/ipfs-cluster
Restart=always
RestartSec=10
LimitNOFILE=10240

[Install]
WantedBy=multi-user.target

Démarrage du service Cluster – leader

[root@node-ipfsl home]# systemctl daemon-reexec
[root@node-ipfsl home]# systemctl daemon-reload
[root@node-ipfsl home]# systemctl enable ipfs-cluster.service
Created symlink /etc/systemd/system/multi-user.target.wants/ipfs-cluster.service → /etc/systemd/system/ipfs-cluster.service.

.[root@node-ipfsl home]# systemctl start ipfs-cluster.service
[root@node-ipfsl home]# systemctl status ipfs-cluster.service

Récupération ID leader

[root@node-ipfsl home]# ipfs-cluster-ctl id |head -8
12D3KooWALCus4V2sFQmK8ZtLeSsBvxsE9GeUpdv4jJvwC3qPpAD | node-ipfsl | Sees 0 other peers
> Addresses:
- /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWALCus4V2sFQmK8ZtLeSsBvxsE9GeUpdv4jJvwC3qPpAD
- /ip4/192.168.1.70/tcp/9096/p2p/12D3KooWALCus4V2sFQmK8ZtLeSsBvxsE9GeUpdv4jJvwC3qPpAD

Services Node-ipfsp1 et Node-ipfsp2 (peers n°1 & 2)

Service cluster – peers

[root@node-ipfsp[1,2] home]# vi /etc/systemd/system/ipfs-cluster-peer.service

[Unit]
Description=IPFS Cluster Peer Service
After=network.target

[Service]
User=root
Group=root
Environment=IPFS_CLUSTER_PATH=/mnt/ipfs-data/ipfs-cluster
ExecStart=/usr/local/bin/ipfs-cluster-service daemon --bootstrap /ip4/192.168.1.70/tcp/9096/p2p/12D3KooWALCus4V2sFQmK8ZtLeSsBvxsE9GeUpdv4jJvwC3qPpAD
WorkingDirectory=/mnt/ipfs-data/ipfs-cluster
Restart=always
RestartSec=10
LimitNOFILE=10240

[Install]
WantedBy=multi-user.target

Démarrage du service Cluster – node-ipfsp1

[root@node-ipfsp1 home]# systemctl daemon-reexec
[root@node-ipfsp1 home]# systemctl daemon-reload
[root@node-ipfsp1 home]# systemctl enable ipfs-cluster-peer.service
Created symlink /etc/systemd/system/multi-user.target.wants/ipfs-cluster-peer.service → /etc/systemd/system/ipfs-cluster-peer.service.

[root@node-ipfsl home]# journalctl -f
[root@node-ipfsp1 home]# systemctl start ipfs-cluster-peer.service

Check add Node-ipfsl

[root@node-ipfsl home]# systemctl status ipfs-cluster-peer.service

Sur le journal de log leader

[root@node-ipfsl home]# ipfs-cluster-ctl peers ls |grep 192

Démarrage du service Cluster – node-ipfsp2

[root@node-ipfsp2 home]# systemctl daemon-reexec
[root@node-ipfsp2 home]# systemctl daemon-reload
[root@node-ipfsp2 home]# systemctl enable ipfs-cluster-peer.service
Created symlink /etc/systemd/system/multi-user.target.wants/ipfs-cluster-peer.service → /etc/systemd/system/ipfs-cluster-peer.service.

Check add Node-ipfsl

[root@node-ipfsl home]# journalctl -f
[root@node-ipfsp2 home]# systemctl start ipfs-cluster-peer.service

Sur le journal de log leader

[root@node-ipfsl home]# ipfs-cluster-ctl peers ls |grep 192

13. Application Web API IPFS

  • http://192.168.1.70:5001/webui

Cliquez sur « Pairs »

Notre Cluster et machines sont Public

Recherche nos machines sur le domaine public

Node-ipfsl (leader)

[root@node-ipfsl home]# ipfs id |grep -i ID |head -1
 "ID": "12D3KooWCWwgEQx51YWB54Fn82JVQJ1SNm52sTHmNtQQAvMr6yza",

Node-ipfsp1 (peer n°1)

[root@node-ipfsp1 home]# ipfs id |grep -i ID |head -1
 "ID": "12D3KooWJb4HwVbXFuxZSeFAUjocurt7gPw14G6CsZRwTpVgMNdP",

Node-ipfsp1 (peer n°2)

[root@node-ipfsp2 home]# ipfs id |grep -i ID |head -1
 "ID": "12D3KooWQ4VuBLMjVvmW4F4fhKxbArFG4Y9SQ3coVBo1PL29qrJx",

Views: 3

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *