In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how mkcephfs creates clusters. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
$0 is mkcephfs.
1. Verify the conf file and create a random temporary directory:
dir = /tmp/mkcephfs.jYWWOaxaTa
2 . Execution: $0 --prepare-monmap -d $dir -c $conf
1) Get mon list, mon id, and mon address:
mons=`$CCONF -c $conf -l mon | egrep -v '^mon$' | sort`
id=`echo $name | cut -c 4- | sed 's/^\\.// '`
get_conf addr "" "mon addr"
Then args: args = --add 0 192.168.100.61:6789
2) Create monmap in $dir/monmap
$BINDIR/monmaptool --create --clobber $args --print $monmap || exit 1
In this, fsid is generated and epoch0 is written to/tmp/mkcephfs.jYWWOaxaTa/monmap
3) Copy the ceph.conf file:
cp $conf $dir/conf
At this point, the $0 --prepare-monmap -d $dir -c $conf command ends.
3. Just take osd_list and mds_lilst to form name_list, traverse name_llist and execute:
1) If it is a remote host, then call scp to push conf and monmap to the temporary directory of the remote host $host:$rdir:
rdir=`mktemp -u /tmp/mkfs.ceph.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
2)do_root_cmd "$0 -d $rdir --init-daemon $name"
s1. Check/var/run/ceph/$name.pid and/var/run/ceph/$name.asok and create the appropriate directories
s2 . If the $type of $name is osd, then:
$BINDIR/ceph-osd -c $conf --monmap $dir/monmap -i $id --mkfs --mkkey
get_conf osd_data "/var/lib/ceph/osd/ceph-$id" "osd data"
get_conf osd_keyring "$osd_data/keyring" "keyring"
$BINDIR/ceph-authtool -p -n $name $osd_keyring > $dir/key.$ name
s3. If $type is mds, then:
get_conf mds_data "/var/lib/ceph/mds/ceph-$id" "mds data"
get_conf mds_keyring "$mds_data/keyring" "keyring"
test -d $mds_data || mkdir -p $mds_data
echo "creating private key for $name keyring $mds_keyring"
$BINDIR/ceph-authtool --create-keyring --gen-key -n $name $mds_keyring
$BINDIR/ceph-authtool -p -n $name $mds_keyring > $dir/key.$ name
3)If with--mkfs argument, format partition as well
do_root_cmd "$0 -d $rdir --prepare-osdfs $name"
4) If it is a remote host, collect keys from remote nodes
scp -q $host:$rdir/key.$ name $dir
4. Prepare monitors, execute $0 -d $dir --prepare-mon $moreargs:
At this point, moeargs already contains more parameters: numosd osdmap crushmapsrc crushmap
1) If useosdmap is not empty, use useosdmap: cp $useosdmap $dir/osdmap, otherwise create a generic osdmap from the conf file:
$BINDIR/osdmaptool --create-from-conf $dir/osdmap -c $conf
2)Get crushmapsrc:
get_conf crushmapsrc "" "crush map src" mon global
If $crushmapsrc is not empty, we get a map file from crushmapsrc and save it as $dir/crushmap:
$BINDIR/crushtool -c $crushmapsrc -o $dir/crushmap
3) Get crushmap:
get_conf crushmap "$usecrushmap" "crush map" mon global
If $crushmap is not empty, import $crushmap into $dir/crushmap:
$BINDIR/osdmaptool --import-crush $crushmap $dir/osdmap
4) Generate admin keyring and save it to $dir/keyring.admin:
$BINDIR/ceph-authtool --create-keyring --gen-key -n client.admin $dir/keyring.admin
5) Create the initial monitor keyring:
s1. cp $dir/keyring.admin $dir/keyring.mon
s2. $BINDIR/ceph-authtool -n client.admin --set-uid=0 \
--cap mon 'allow *' \
--cap osd 'allow *' \
--cap mds 'allow' \
$dir/keyring.mon
s3. $BINDIR/ceph-authtool --gen-key -n mon. $dir/keyring.mon --cap mon 'allow *'
6)Traverse $dir/key.*:
If ktype is osd:
$BINDIR/ceph-authtool -n $kname --add-key $secret $dir/keyring.mon \
--cap mon 'allow rwx' \
--cap osd 'allow *'
If type is MDS:
$BINDIR/ceph-authtool -n $kname --add-key $secret $dir/keyring.mon \
--cap mon "allow rwx" \
--cap osd 'allow *' \
--cap mds 'allow'
5. Traverse mon_list and execute:
1)Push Profile
If it is a remote host, push the local $dir/* to $rdir first:
rdir=`mktemp -u /tmp/mkfs.ceph.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
Otherwise cp $dir/conf /etc/ceph/ceph.conf if local host
2)Start the mon daemon:
do_root_cmd "$0 -d $rdir --init-daemon $name"
s1. Check/var/run/ceph/$name.pid and/var/run/ceph/$name.asok and create the appropriate directories
S2. If $type is mon, then:
get_conf mon_data "/var/lib/ceph/mon/ceph-$id" "mon data"
mkdir -p "$mon_data"
$BINDIR/ceph-mon -c $conf --mkfs -i $id --monmap $dir/monmap --osdmap $dir/osdmap -k $dir/keyring.mon
6 . Get adminkerying:
get_conf adminkeyring "/etc/ceph/keyring" "keyring" global
cp $dir/keyring.admin $adminkeyring
Thank you for reading! About "mkcephfs how to create clusters" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
With the increasing influence of open source software around the world, Linux server fuck
© 2024 shulou.com SLNews company. All rights reserved.