diff --git a/.ssh/ceph-admin-id_rsa b/.ssh/ceph-admin-id_rsa index f501f2c..cd4862d 100644 --- a/.ssh/ceph-admin-id_rsa +++ b/.ssh/ceph-admin-id_rsa @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAu5e+bso/uGXOjw1lFtuNMH55KYFIcfg88rfZWWnWWK+si5PH -yxAo66VEkdWcfThFEEpre3z6/oNgwvShiW2DoRPB4E5VjziTUgcAzPK91m0vfnq4 -M/hup4qSXZiZQnTDcgF0kmvOl5FNLf1q7nFwZO7QuRAUemc7exSQ2aZ6A1pcmKpG -Af3NH6w4XgwVNTMrn4GQ4XxRe9buO/1AqrhUL5vjayJdkE9RgZ+ZTOVc8uVS7Gbz -q0daD6PFDNd8Sa3gh+TXK4JKSC3NMb2kg937ncC+YiRliI1idIK/age/isq4Xz8L -XdqAx+iWRjZomAxeSs1c8MvFemOJqkHX+sjuPQIDAQABAoIBAQCZSjE5tRkGpGJ6 -8NYnLHceJmr5qIQ7ZT7gk60O7HZT+BGF6Nd9LpJRpLX4eVYr2LxOyJE10nYDXfXG -uUH627uQ92UY1soBg5iWkdRspPrNamFB+CPni91YGNrrkpPCA0nmMhxAvcmOfxRT -PV6Qw6+1OpTidKpXL14igDaxM+FGNL14uflvVm3hRGmtlV8KH/w263IGEHY+QV3n -KbRKB0SgPIVTgPwb8h66wc1uJEynV3K1dKDr7VPIUMnQ8/QnnWiDFsUgxHW4fYxF -IbaL+AHf9xhqr5GGVpYP86GoZ7rjiplGJ513isVRpPIXFknpys6nwQ9av3nGSC6G -pWaW8VQdAoGBAN9sFfybQSFEFGML5/zxVcgYWM9Q1LukiKyLsa6w/Y4CYjeWA8bp -1i6j1XjB122xoTZaE9fmHcsNVcOr+kdgC++413TZmie3Uck6n7yElY1/l8q0+5+0 -BNV0r+36RpGeTDW9ii6+tHU89Drlr4NPdQC807nIsWjVkAjfYihD9CwrAoGBANby -NtwLoTPeX7QAinUXci8UL04vXkI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cNvnyqpcpEZLGQ +yVCNoNKff7N0a912TfwnzPkj5kw6MXSIMAfp0cAmsyKd9KgSwGrMdmjbVjY709Rx +pe49jhE8Tq//ejBOCPg2iMr3u6seSqeq2SHl468WeQz6DnCCXdq17g== -----END RSA PRIVATE KEY----- diff --git a/.ssh/ceph-admin-id_rsa.pub b/.ssh/ceph-admin-id_rsa.pub index e56fe20..2cbc0b4 100644 --- a/.ssh/ceph-admin-id_rsa.pub +++ b/.ssh/ceph-admin-id_rsa.pub @@ -1 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7l75uyj+4Zc6PDWUW240wfnkpgUhx+Dzyt9lZadZYr6yLk8fLECjrpUSR1Zx9OEUQSmt7fPr+g2DC9KGJbYOhE8HgTlWPOJNSBwDM8r3WbS9+ergz+G6nipJdmJlCdMNyAXSSa86XkU0t/WrucXBk7tC5EBR6Zzt7FJDZpnoDWlyYqkYB/c0frDheDBU1MyufgZDhfFF71u47/UCquFQvm+NrIl2QT1GBn5lM5Vzy5VLsZvOrR1oPo8UM13xJreCH5NcrgkpILc0xvaSD3fudwL5iJGWIjWJ0gr9qB7+KyrhfPwtd2oDH6JZGNmiYDF5KzVzwy8V6Y4mqQdf6yO49 matou@catsserver-3 +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5prsYpglvYbMJ2MM3Ny/J75JZZ/0+ENPucrIIM5EU7+lwhPqPridewdppMT34LCD87siXtBG9KCFrmBGUu1pufmOe6lO0RVPYDFitc1Uke+BLitj5OyiteCsvejHNG7mAqtWvg69Sr/Br5K6PW8uNU8H6nkNTYHg+xnMxp+6A4S280WUFw2AECcUhI8HdHtuSyvalpF83Uoy5YZk/9ojgLGX6nUirBL0m8XxWem4n6WL/f8twGy1TRUO8FtcIvMhggxTQnzzkbdjV6YSIoE57R/ijHALALUgtlikQGAF430ZZXKBqsG36E4619v5kNXPCPbXvQvglmBey6vDlH5tf matou@catsserver-3 diff --git a/Vagrantfile b/Vagrantfile index d1caf11..0368018 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -24,6 +24,13 @@ Vagrant.configure("2") do |config| libvirt.video_type = "qxl" end + # Define bridged public network + config.vm.network :public_network, + :dev => "eno1", + :mode => "bridge", + :type => "bridge", + :network_name => "public-net" + # admin VM config.vm.define "node-admin", primary: true do |admin| admin.vm.hostname = "node-admin" diff --git a/scripts/ceph-install.sh b/scripts/ceph-install.sh index 1ba7f9e..086f3ee 100755 --- a/scripts/ceph-install.sh +++ b/scripts/ceph-install.sh @@ -32,12 +32,27 @@ GUEST_USER_DIR="/home/$CEPH_ADMIN_USER" GUEST_USER_SSH_DIR="$GUEST_USER_DIR/.ssh" GUEST_VAGRANT_SCRIPT_DIR="/vagrant/scripts" GUEST_VAGRANT_SSH_DIR="/vagrant/.ssh" +# Network (dynamically defined by Vagrant) +IP_ADDRESS=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) +PUBLIC_NETWORK=$(echo $IP_ADDRESS | awk -F '.' '{print $1"."$2"."$3".0"}') +# Make sure only CEPH_ADMIN_USER can run the script +if [[ $(whoami) != $CEPH_ADMIN_USER ]]; then + echo "This script must be run as $CEPH_ADMIN_USER" 1>&2 + exit 1 +fi + +# Cluster configuration directory mkdir -p "$GUEST_USER_DIR/ceph-cluster" cd "$GUEST_USER_DIR/ceph-cluster" -#ceph-deploy new node-admin -#echo "public network = $PUBLIC_NETWORK" >> ceph.conf -#echo "cluster network = $CLUSTER_NETWORK" >> ceph.conf -#echo "" >> ceph.conf -#echo "osd pool default size = 2" >> ceph.conf -#echo "osd pool default min size = 1" >> ceph.conf \ No newline at end of file + +# Initialize cluster configuration +ceph-deploy new node-admin +echo "public network = $PUBLIC_NETWORK" >> ceph.conf +echo "cluster network = $CLUSTER_NETWORK" >> ceph.conf +echo "" >> ceph.conf +echo "osd pool default size = 2" >> ceph.conf +echo "osd pool default min size = 1" >> ceph.conf + +# Install ceph on all nodes +ceph-deploy install --release luminous node-admin node-osd1 node-osd2 \ No newline at end of file diff --git a/scripts/ceph-preflight.sh b/scripts/ceph-preflight.sh index 56efb8f..9343c37 100755 --- a/scripts/ceph-preflight.sh +++ b/scripts/ceph-preflight.sh @@ -60,7 +60,7 @@ $CEPH_ADMIN_EXEC rm -f "$GUEST_USER_SSH_DIR/authorized_keys" $CEPH_ADMIN_EXEC cp "$GUEST_VAGRANT_SSH_DIR/$CEPH_ADMIN_USER-id_rsa.pub" "$GUEST_USER_SSH_DIR/authorized_keys" $CEPH_ADMIN_EXEC chmod 644 "$GUEST_USER_SSH_DIR/authorized_keys" -# Make debconf non interactive +# Make debconf non interactive and set the right local export DEBIAN_FRONTEND=noninteractive # Install ceph repository @@ -68,14 +68,25 @@ wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add - echo deb https://download.ceph.com/debian/ $(lsb_release -sc) main | tee /etc/apt/sources.list.d/ceph.list apt-get update -# Install chrony (time synchronization) and ceph-deploy -apt-get -y install chrony ceph-deploy +# Install chrony for time synchronization, gdisk for GPT partitioning, +# vnstat for network stats, htop for system monitor and ceph-deploy +apt-get -y install chrony gdisk vnstat htop ceph-deploy # Modify /etc/hosts to allow ceph-deploy to resolve the guest # Need to replace the loopback address by the real address GUEST_NAME=$(hostname -s) -GUEST_IP=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) -sed -i "s/127.0.0.1\t$GUEST_NAME\t$GUEST_NAME/$GUEST_IP\t$GUEST_NAME\t$GUEST_NAME/g" /etc/hosts +IP_ADDRESS=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) +sed -i "s/127.0.0.1\t$GUEST_NAME\t$GUEST_NAME/$IP_ADDRESS\t$GUEST_NAME\t$GUEST_NAME/g" /etc/hosts + +# Create partitions on journal disk for osd nodes only +for NODE in $OSD_NODES; do + if [[ NODE == $GUEST_NAME ]]; then + sgdisk --new=0:0:10G /dev/vda > /dev/null 2>&1 + sgdisk --new=0:0:20G /dev/vda > /dev/null 2>&1 + sgdisk --largest-new=0 /dev/vda > /dev/null 2>&1 + sgdisk --print /dev/vda + fi +done # Full update #apt-get -y dist-upgrade diff --git a/scripts/cephtest-utils.sh b/scripts/cephtest-utils.sh index 96edf43..944f17a 100755 --- a/scripts/cephtest-utils.sh +++ b/scripts/cephtest-utils.sh @@ -29,6 +29,10 @@ CEPH_ADMIN_USER="ceph-admin" CEPH_ADMIN_EXEC="sudo -i -u $CEPH_ADMIN_USER" # Machines -NODES="node-admin node-osd1 node-osd2" ADMIN_NODE="node-admin" +OSD_NODES="node-osd1 node-osd2" +NODES="$ADMIN_NODE $OSD_NODES" + +# Networks +CLUSTER_NETWORK="172.28.128.0"