-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathadd-ceph-mds
More file actions
55 lines (43 loc) · 1.35 KB
/
add-ceph-mds
File metadata and controls
55 lines (43 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Bailey Allison <ballison@45drives.com
# Matthew Hutchinson <mhutchinson@45drives.com>
#v7
OS=$(cat /etc/os-release | grep -w NAME)
if [ "$OS" == 'NAME="Rocky Linux"' ]; then
dnf install ceph-mds
elif [ "$OS" == 'NAME="Ubuntu"' ]; then
apt install ceph-mds
else
echo "OS is not Ubuntu or Rocky Linux"
exit
fi
# Check for ceph.conf and admin keyring
if [[ ! -f "/etc/ceph/ceph.conf" || ! -f "/etc/ceph/ceph.client.admin.keyring" ]]; then
echo "ceph conf and admin keyring not on host, exiting"
exit 1
fi
# Gather current number of MDSs and add 1
BASE_HOSTNAME=$(hostname -s)
HOSTNAME=$BASE_HOSTNAME
COUNTER=1
DIR="/var/lib/ceph/mds/ceph-$HOSTNAME"
while [ -d "$DIR" ]; do
HOSTNAME="${BASE_HOSTNAME}-${COUNTER}"
DIR="/var/lib/ceph/mds/ceph-$HOSTNAME"
((COUNTER++))
done
# Create Keyring Directory and make Keyring
echo "Creating Keyring"
mkdir "$DIR"
chown ceph:ceph "$DIR"
ceph auth get-or-create mds.$HOSTNAME mon 'profile mds' mgr 'profile mds' mds 'allow *' osd 'allow *' > "$DIR/keyring"
chown ceph:ceph "$DIR/keyring"
# Open Firewall ports
echo "Opening Firewall"
firewall-cmd --add-service={ceph,ceph-mon} --permanent
firewall-cmd --reload
# Start MDS Service
echo "Starting MDS service"
systemctl enable --now ceph-mds@$HOSTNAME
ceph -s
echo -e "\e[1;31mmds-$HOSTNAME\e[0m has been \e[1;32madded\e[0m"