Projet

Général

Profil

Openstack Installation TTNN » Historique » Version 228

Laurent GUERBY, 14/11/2014 11:30

1 43 Laurent GUERBY
{{>toc}}
2 43 Laurent GUERBY
3 159 Laurent GUERBY
h1. Openstack Installation tetaneutral.net
4 1 Mehdi Abaakouk
5 44 Laurent GUERBY
h2. Liens
6 44 Laurent GUERBY
7 204 Mehdi Abaakouk
* [[Openstack Management TTNN]]
8 204 Mehdi Abaakouk
* [[Openstack Setup VM pas dans openstack]]
9 44 Laurent GUERBY
* http://ceph.com/docs/master/rados/operations/cache-tiering/
10 44 Laurent GUERBY
* http://ceph.com/docs/master/rados/operations/crush-map/
11 44 Laurent GUERBY
12 3 Mehdi Abaakouk
h2. Pending upstream fixes:
13 3 Mehdi Abaakouk
14 143 Mehdi Abaakouk
La liste à jour est ici: 
15 143 Mehdi Abaakouk
http://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster/revisions/master/entry/manifests/nodes/openstack.pp#L27
16 1 Mehdi Abaakouk
17 4 Mehdi Abaakouk
h2. Installation
18 4 Mehdi Abaakouk
19 213 Laurent GUERBY
L'installation initiale est composée de :
20 4 Mehdi Abaakouk
21 4 Mehdi Abaakouk
* 3 hyperviseurs (compute node) qui contiendront 1 ceph-mon, N ceph-osd, nova-compute (qui lance les VM), neutron-openvswitch-agent (qui configure le réseau des vms)
22 4 Mehdi Abaakouk
* 1 VM (controler node), qui contient tous les services de management d'openstack (nova, cinder, glance, neutron)
23 4 Mehdi Abaakouk
24 4 Mehdi Abaakouk
Les étapes d'installation sont les suivantes:
25 4 Mehdi Abaakouk
* Préparation manuelle de la VM de management sur un des hyperviseurs
26 4 Mehdi Abaakouk
* Installation de ceph et openstack sur toutes les machines avec puppet
27 4 Mehdi Abaakouk
* Déplacement de la VM de management d'openstack dans openstack.
28 4 Mehdi Abaakouk
29 33 Mehdi Abaakouk
h3. Information sur le puppet master:
30 33 Mehdi Abaakouk
31 213 Laurent GUERBY
La configuration et les modules puppet utilisés par tetaneutral.net se trouvent la:
32 33 Mehdi Abaakouk
33 33 Mehdi Abaakouk
> http://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster
34 33 Mehdi Abaakouk
> http://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster/revisions/master/entry/manifests/nodes/openstack.pp
35 33 Mehdi Abaakouk
36 213 Laurent GUERBY
Seulement les 3 classes suivantes sont spécifique à http://tetaneutral.net, le reste est réutilisable à condition de changer les ip, hostname, uuid et password :
37 33 Mehdi Abaakouk
38 36 Mehdi Abaakouk
> class { 'ttnn::server': }
39 36 Mehdi Abaakouk
> class { 'backup::client': }
40 36 Mehdi Abaakouk
> class { 'sexymotd': }
41 33 Mehdi Abaakouk
42 213 Laurent GUERBY
Les modules qui sont nécessaire pour openstack pour le reste du fichier sont :
43 33 Mehdi Abaakouk
44 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-apache.git 
45 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-apt 
46 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-ceph.git 
47 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-cinder.git 
48 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-concat.git 
49 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-glance.git 
50 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-horizon.git 
51 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-inifile.git 
52 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-keystone.git 
53 33 Mehdi Abaakouk
> https://github.com/camptocamp/puppet-kmod.git 
54 33 Mehdi Abaakouk
> https://github.com/saz/puppet-memcached.git 
55 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-mysql.git 
56 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-neutron.git 
57 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-nova.git 
58 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-rabbitmq.git 
59 33 Mehdi Abaakouk
> https://github.com/nanliu/puppet-staging.git 
60 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-stdlib.git 
61 33 Mehdi Abaakouk
> https://github.com/duritong/puppet-sysctl.git 
62 33 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-vcsrepo.git 
63 33 Mehdi Abaakouk
> https://github.com/stackforge/puppet-vswitch.git 
64 36 Mehdi Abaakouk
> https://github.com/puppetlabs/puppetlabs-xinetd.git
65 33 Mehdi Abaakouk
66 33 Mehdi Abaakouk
h3. Préparation réseaux des hosts:
67 29 Mehdi Abaakouk
68 1 Mehdi Abaakouk
69 126 Mehdi Abaakouk
Preparation des bridges openvswitch:
70 126 Mehdi Abaakouk
71 1 Mehdi Abaakouk
<pre>
72 130 Mehdi Abaakouk
$ apt-get install openvswitch-switch 
73 126 Mehdi Abaakouk
$ modprobe vhost-net
74 126 Mehdi Abaakouk
$ modprobe tun
75 126 Mehdi Abaakouk
$ modprobe loop
76 148 Mehdi Abaakouk
77 148 Mehdi Abaakouk
# On créé un switch br-eth0
78 151 Mehdi Abaakouk
ovs-vsctl add-br br-eth0
79 148 Mehdi Abaakouk
# On rajoute une petite bricole pour openstack 
80 151 Mehdi Abaakouk
ovs-vsctl br-set-external-id br-eth0 bridge-id br-eth0
81 148 Mehdi Abaakouk
# On ajoute le port eth0 dans le switch
82 151 Mehdi Abaakouk
ovs-vsctl add-port br-eth0 eth0  # Si aucun trunk vlan n'est spécifié, c'est un trunk avec tous les vlans 
83 148 Mehdi Abaakouk
84 148 Mehdi Abaakouk
# On créé des interfaces réseau utilisable sur la machine avec des vlans:
85 155 Mehdi Abaakouk
ovs-vsctl add-br vlan3132 br-eth0 3132
86 151 Mehdi Abaakouk
ovs-vsctl add-br vlan3175 br-eth0 3175
87 151 Mehdi Abaakouk
ovs-vsctl add-br vlan3199 br-eth0 3199
88 148 Mehdi Abaakouk
89 150 Mehdi Abaakouk
# On s'assure que eth0 sera toujours up
90 151 Mehdi Abaakouk
ovs-ofctl mod-port br-eth0 eth0 up
91 150 Mehdi Abaakouk
92 126 Mehdi Abaakouk
</pre>
93 1 Mehdi Abaakouk
94 126 Mehdi Abaakouk
_note: Les bridges openvswitch sont mémorisés et recréés automatiquement par le service openvswitch-switch_
95 126 Mehdi Abaakouk
96 133 Mehdi Abaakouk
On install le fichier attachment:rc.local dans /etc/
97 133 Mehdi Abaakouk
Et le fichier attachment:tetaneutral-openstack-routing-daemon.sh dans /root/
98 1 Mehdi Abaakouk
99 1 Mehdi Abaakouk
On re-charge le fichier attachment:rc.local
100 133 Mehdi Abaakouk
101 133 Mehdi Abaakouk
<pre>
102 126 Mehdi Abaakouk
bash -x /etc/rc.local
103 1 Mehdi Abaakouk
</pre>
104 126 Mehdi Abaakouk
105 126 Mehdi Abaakouk
106 126 Mehdi Abaakouk
Sur h7.tetaneutral.net le routage est le suivant
107 73 Mehdi Abaakouk
108 73 Mehdi Abaakouk
<pre>
109 155 Mehdi Abaakouk
ip route add 89.234.156.249/32 dev eth0.3132
110 155 Mehdi Abaakouk
ip route add 89.234.156.251/32 dev eth0.3132
111 155 Mehdi Abaakouk
ip route add 89.234.156.252/32 dev eth0.3132
112 155 Mehdi Abaakouk
ip route add 89.234.156.253/32 dev eth0.3132
113 155 Mehdi Abaakouk
ip route add 2a01:6600:8083:f900::/56 dev eth0.3132
114 155 Mehdi Abaakouk
ip route add 2a01:6600:8083:fb00::/56 dev eth0.3132
115 155 Mehdi Abaakouk
ip route add 2a01:6600:8083:fc00::/56 dev eth0.3132
116 155 Mehdi Abaakouk
ip route add 2a01:6600:8083:fd00::/56 dev eth0.3132
117 16 Mehdi Abaakouk
</pre>
118 1 Mehdi Abaakouk
119 20 Mehdi Abaakouk
h3. Preparation de la VM de management, le controlleur
120 6 Mehdi Abaakouk
121 6 Mehdi Abaakouk
h4. Installation des prérequis
122 6 Mehdi Abaakouk
123 1 Mehdi Abaakouk
<pre>
124 129 Mehdi Abaakouk
$ apt-get install libvirt-bin openstack-debian-images virtinst
125 131 Mehdi Abaakouk
#NOTE(sileht): temporairement récupérer la dernière version:
126 131 Mehdi Abaakouk
$ curl -# http://anonscm.debian.org/cgit/openstack/openstack-debian-images.git/plain/build-openstack-debian-image > /usr/sbin/build-openstack-debian-image
127 20 Mehdi Abaakouk
</pre>
128 1 Mehdi Abaakouk
129 1 Mehdi Abaakouk
h4. Preparation de l'image de la VM
130 92 Mehdi Abaakouk
131 20 Mehdi Abaakouk
<pre>
132 20 Mehdi Abaakouk
$ vim hook.sh
133 1 Mehdi Abaakouk
set -xv
134 20 Mehdi Abaakouk
135 92 Mehdi Abaakouk
echo "openstack" > $BODI_CHROOT_PATH/etc/hostname
136 40 Mehdi Abaakouk
137 46 Mehdi Abaakouk
cat > $BODI_CHROOT_PATH/etc/resolv.conf <<EOF
138 46 Mehdi Abaakouk
domain tetaneutral.net
139 46 Mehdi Abaakouk
search tetaneutral.net
140 1 Mehdi Abaakouk
nameserver 8.8.8.8
141 46 Mehdi Abaakouk
EOF
142 46 Mehdi Abaakouk
143 92 Mehdi Abaakouk
cat > $BODI_CHROOT_PATH/etc/network/interfaces <<EOF
144 6 Mehdi Abaakouk
auto lo
145 20 Mehdi Abaakouk
iface lo inet loopback
146 1 Mehdi Abaakouk
auto eth0
147 6 Mehdi Abaakouk
iface eth0 inet manual
148 4 Mehdi Abaakouk
  pre-up /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra=0
149 1 Mehdi Abaakouk
  pre-up /sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0
150 4 Mehdi Abaakouk
  up ip link set eth0 up
151 10 Mehdi Abaakouk
  up ip addr add 89.234.156.249/32 dev eth0
152 152 Mehdi Abaakouk
  up ip route add 91.224.149.0/24 dev eth0
153 152 Mehdi Abaakouk
  up ip route add default via 91.224.149.254
154 20 Mehdi Abaakouk
155 1 Mehdi Abaakouk
iface eth0 inet6 static
156 7 Mehdi Abaakouk
    pre-up /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra=0
157 4 Mehdi Abaakouk
    pre-up /sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0
158 21 Mehdi Abaakouk
    address 2a01:6600:8083:f900::1
159 12 Mehdi Abaakouk
    netmask 56
160 4 Mehdi Abaakouk
    gateway fe80::31
161 4 Mehdi Abaakouk
162 4 Mehdi Abaakouk
auto eth1
163 5 Mehdi Abaakouk
iface eth1 inet static
164 13 Mehdi Abaakouk
  pre-up /sbin/sysctl -w net.ipv6.conf.eth1.accept_ra=0
165 18 Mehdi Abaakouk
  pre-up /sbin/sysctl -w net.ipv6.conf.eth1.autoconf=0
166 18 Mehdi Abaakouk
  address 192.168.3.100
167 18 Mehdi Abaakouk
  netmask 255.255.255.0
168 18 Mehdi Abaakouk
EOF
169 18 Mehdi Abaakouk
170 18 Mehdi Abaakouk
mkdir -p $BODI_CHROOT_PATH/root/.ssh
171 59 Mehdi Abaakouk
chmod 600 $BODI_CHROOT_PATH/root/.ssh
172 59 Mehdi Abaakouk
cat >> $BODI_CHROOT_PATH/root/.ssh/authorized_keys <<EOF
173 11 Mehdi Abaakouk
ssh-dss AAAAB3NzaC1kc3MAAACBAJtnGLvuz4uVD6fnERDxDi/C0UyzwCiKmgNtEessopREYasAX4Gu6Fg10jAyIL5Nuc7YDnqj//pOfxNjD7hp99a2ZmkRQgh/ltClxYML9fqhBHgsUCpVse9nOYDHDnDgvXIPRSDUHat2UFpdchHVrFURNLIlZnBztsr+GCDURTV/AAAAFQD9SrBcH49ltaKOm6V5ssCPmgs1SwAAAIAbAvkQ3/tMzzdACO5B9s5Yb3ZuM7XImm0iqufivVf2Xy39g8HOBulUsN7eKEGPhVriqNolgIO7q7tVgYAff4/NE4yDP0Kp0SPg4tjt2yFJuL31Y3wzwHjnKrjgNlDSLl3uZnRXSipwUMwGKbdHB6NZSqlq192VKbHilQ00pbiMlAAAAIB5dfB1lVHkJ0o5CcaVQRPbca9DvbbRwnoTSmKHc5DUcqsPqDhS07CkM9ZcJuY1Nh4wGl4Q9kArj7Tnsvvygf/HReSUcIk4+nbDytJ8/pca/Qx4fzQQyppa94TylN62LSFT6MIJKLoMwYa0dQURT7Mv5+9Qj2vk5pZ38w2iQ9zVCg== root@h1
174 4 Mehdi Abaakouk
EOF
175 4 Mehdi Abaakouk
176 6 Mehdi Abaakouk
sed -i -e 's/^.*Port.*$/Port 2222/' -e 's/^[# ]*PasswordAuthentication.*$/PasswordAuthentication no/' $BODI_CHROOT_PATH/etc/ssh/sshd_config
177 4 Mehdi Abaakouk
chroot $BODI_CHROOT_PATH dpkg-reconfigure openssh-server
178 4 Mehdi Abaakouk
chroot $BODI_CHROOT_PATH apt-get purge -y cloud-init*
179 8 Mehdi Abaakouk
</pre>
180 1 Mehdi Abaakouk
181 90 Mehdi Abaakouk
<pre>
182 90 Mehdi Abaakouk
$ chmod +x hook.sh
183 156 Mehdi Abaakouk
$ build-openstack-debian-image --image-size 20  --release jessie -u http://apt.tetaneutral.net/debian/ -s http://apt.tetaneutral.net/debian/ --hook-script $(pwd)/hook.sh -e acpi-support
184 90 Mehdi Abaakouk
$ mv debian-jessie-7.0.0-3-amd64.raw /openstack.raw 
185 90 Mehdi Abaakouk
$ rm debian-jessie-7.0.0-3-amd64.qcow2
186 90 Mehdi Abaakouk
</pre>
187 90 Mehdi Abaakouk
188 90 Mehdi Abaakouk
_note: la derniere commande lancée par le script doit être 'qemu-img convert -c -f raw .... , sinon l'image de bootera pas_
189 90 Mehdi Abaakouk
_note(jessie): si l'erreur est celle ci-dessous, relancer manuellement 'kpartx -d debian-jessie-7.0.0-3-amd64.raw' jusqu'a ce que l'erreur disparaissent et le .raw est utilisable:_
190 90 Mehdi Abaakouk
<pre>
191 6 Mehdi Abaakouk
+ 'kpartx -d debian-jessie-7.0.0-3-amd64.raw'
192 1 Mehdi Abaakouk
device-mapper: remove ioctl on loop0p1 failed: Device or resource busy
193 1 Mehdi Abaakouk
loop deleted : /dev/loop0
194 4 Mehdi Abaakouk
</pre>
195 93 Mehdi Abaakouk
_note: si parted freeze -> lancer /etc/init.d/udev restart_
196 19 Mehdi Abaakouk
197 128 Mehdi Abaakouk
198 128 Mehdi Abaakouk
On garde l'image raw qui sera importable dans ceph plus tard et on la mets à la racine pour qui l'utilisateur libvirt puisse y accéder.
199 19 Mehdi Abaakouk
200 24 Mehdi Abaakouk
h4. Installation de la VM
201 19 Mehdi Abaakouk
202 1 Mehdi Abaakouk
<pre>
203 1 Mehdi Abaakouk
$
204 153 Mehdi Abaakouk
$ virt-install --name openstack --ram 2048 --network bridge=br-eth0,model=virtio --network bridge=br-eth0,model=virtio --network bridge=br-eth0,model=virtio --nographics --serial pty --wait -1 --noreboot --autostart --disk /openstack.raw,bus=virtio,cache=none,io=native --import
205 153 Mehdi Abaakouk
206 153 Mehdi Abaakouk
$ virsh edit openstack
207 153 Mehdi Abaakouk
 
208 153 Mehdi Abaakouk
# Pour chaque bridge ajouter, le vlan et openvswitch comme ceci:
209 157 Mehdi Abaakouk
#    <vlan><tag id='3132'/></vlan><virtualport type='openvswitch'/>
210 153 Mehdi Abaakouk
211 144 Mehdi Abaakouk
$ virsh  start openstack
212 1 Mehdi Abaakouk
$ ssh root@89.234.156.249 -p 2222
213 19 Mehdi Abaakouk
</pre>
214 19 Mehdi Abaakouk
215 24 Mehdi Abaakouk
Une fois connecté à la VM:
216 26 Mehdi Abaakouk
217 26 Mehdi Abaakouk
<pre>
218 4 Mehdi Abaakouk
$ apt-get install puppet
219 26 Mehdi Abaakouk
$ puppet agent --enable
220 32 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
221 26 Mehdi Abaakouk
Info: Caching certificate for ca
222 34 Mehdi Abaakouk
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
223 34 Mehdi Abaakouk
Info: Creating a new SSL certificate request for openstack.tetaneutral.net
224 35 Mehdi Abaakouk
Info: Certificate Request fingerprint (SHA256): AE:72:47:40:A0:E2:F4:59:BA:39:FA:3D:C2:A7:C9:1B:9F:87:A5:B7:65:3A:F9:D4:DE:AF:E2:A3:02:41:0F:2E
225 94 Mehdi Abaakouk
Info: Caching certificate for ca
226 35 Mehdi Abaakouk
Exiting; no certificate found and waitforcert is disabled
227 35 Mehdi Abaakouk
</pre>
228 35 Mehdi Abaakouk
229 35 Mehdi Abaakouk
Sur le puppetmaster:
230 35 Mehdi Abaakouk
231 35 Mehdi Abaakouk
<pre>
232 35 Mehdi Abaakouk
$ puppet ca sign openstack.tetaneutral.net 
233 35 Mehdi Abaakouk
</pre>
234 35 Mehdi Abaakouk
_note: si un vieux cert existe: puppet ca revoke openstack.tetaneutral.net ; puppet cert clean openstack.tetaneutral.net; puppet node clean openstack.tetaneutral.net_
235 35 Mehdi Abaakouk
236 35 Mehdi Abaakouk
De nouveau sur la VM:
237 35 Mehdi Abaakouk
238 35 Mehdi Abaakouk
<pre>
239 35 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
240 35 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
241 35 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
242 35 Mehdi Abaakouk
</pre>
243 64 Mehdi Abaakouk
244 35 Mehdi Abaakouk
Il ne doit plus y avoir d'erreur la 3°/4° fois.
245 35 Mehdi Abaakouk
246 35 Mehdi Abaakouk
h3. Configuration des hyperviseurs
247 35 Mehdi Abaakouk
248 35 Mehdi Abaakouk
Une fois la configuration réseau faite, tout ce fait avec puppet:
249 35 Mehdi Abaakouk
250 35 Mehdi Abaakouk
<pre>
251 35 Mehdi Abaakouk
$ apt-get install puppet
252 35 Mehdi Abaakouk
$ puppet agent --enable
253 35 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
254 35 Mehdi Abaakouk
Info: Caching certificate for ca
255 35 Mehdi Abaakouk
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
256 35 Mehdi Abaakouk
Info: Creating a new SSL certificate request for openstack.tetaneutral.net
257 35 Mehdi Abaakouk
Info: Certificate Request fingerprint (SHA256): AE:72:47:40:A0:E2:F4:59:BA:39:FA:3D:C2:A7:C9:1B:9F:87:A5:B7:65:3A:F9:D4:DE:AF:E2:A3:02:41:0F:2E
258 35 Mehdi Abaakouk
Info: Caching certificate for ca
259 35 Mehdi Abaakouk
Exiting; no certificate found and waitforcert is disabled
260 35 Mehdi Abaakouk
</pre>
261 35 Mehdi Abaakouk
262 101 Mehdi Abaakouk
Sur le puppetmaster:
263 35 Mehdi Abaakouk
264 35 Mehdi Abaakouk
<pre>
265 35 Mehdi Abaakouk
$ puppet ca sign openstack.tetaneutral.net 
266 35 Mehdi Abaakouk
</pre>
267 35 Mehdi Abaakouk
_note: si un vieux cert existe: puppet ca revoke openstack.tetaneutral.net ; puppet cert clean openstack.tetaneutral.net; puppet node clean openstack.tetaneutral.net_
268 35 Mehdi Abaakouk
269 35 Mehdi Abaakouk
De nouveau sur la VM:
270 35 Mehdi Abaakouk
271 35 Mehdi Abaakouk
<pre>
272 35 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
273 100 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
274 100 Mehdi Abaakouk
$ puppet agent -vt --server puppet.tetaneutral.net --certname openstack.tetaneutral.net --pluginsync 
275 100 Mehdi Abaakouk
</pre>
276 100 Mehdi Abaakouk
277 35 Mehdi Abaakouk
Il ne doit plus y avoir d'erreur la 3°/4° fois.
278 1 Mehdi Abaakouk
279 187 Mehdi Abaakouk
h3. Information sur la configuration d'un hyperviseur sur le puppet master
280 37 Mehdi Abaakouk
281 38 Mehdi Abaakouk
La configuration puppet ressemble à :
282 38 Mehdi Abaakouk
283 109 Mehdi Abaakouk
<pre>
284 1 Mehdi Abaakouk
node "gX.tetaneutral.net" inherits openstack_node_common {
285 120 Mehdi Abaakouk
  # Configuration du routerid et de l'AS number de cette machine
286 1 Mehdi Abaakouk
  # Il faut aussi mettre la conf bgp de h7 ainsi que les fichiers 
287 1 Mehdi Abaakouk
  # /etc/puppet/manifests/files/openstack-bird.conf.erb et
288 125 Mehdi Abaakouk
  # /etc/puppet/manifests/files/openstack-bird6.conf.erb
289 125 Mehdi Abaakouk
  # pour ajouter cette AS interne
290 97 Mehdi Abaakouk
  ttnn_os_bird {'198.51.100.1': asnum => "65001"}
291 109 Mehdi Abaakouk
292 120 Mehdi Abaakouk
  # Dans le cas d'une moniteur ceph, mais uniquement 3 suffissent, on a déjà g1,g2,g3
293 109 Mehdi Abaakouk
  ttnn_ceph_mon {$::hostname:}
294 88 Mehdi Abaakouk
  # Sinon utilisait:
295 88 Mehdi Abaakouk
  # class{"ttnn_ceph_osd_only": }
296 109 Mehdi Abaakouk
297 88 Mehdi Abaakouk
  # La partie Openstack, l'uuid doit être unique par machine (générer avec uuid-gen)
298 109 Mehdi Abaakouk
  ttnn_os_compute {"9d26ec10-a48b-4f0f-a122-f10ed16d270f": }
299 109 Mehdi Abaakouk
}
300 109 Mehdi Abaakouk
</pre>
301 109 Mehdi Abaakouk
302 109 Mehdi Abaakouk
h3. Déplacement du disk du controlleur dans le cluster ceph
303 109 Mehdi Abaakouk
304 97 Mehdi Abaakouk
Les recettes puppet on créé un pool disks pour les mettres les VMs et volumes de VM
305 97 Mehdi Abaakouk
306 109 Mehdi Abaakouk
307 97 Mehdi Abaakouk
Sur g1, on import le disque de la VM dans ceph et on modifie la conf libvirt:
308 97 Mehdi Abaakouk
309 109 Mehdi Abaakouk
<pre>
310 111 Mehdi Abaakouk
$ virsh shutdown openstack
311 1 Mehdi Abaakouk
$ rbd -p disks import /var/lib/ceph/osd/ceph-0/openstack.raw  openstack-disk
312 1 Mehdi Abaakouk
$ virsh edit openstack
313 1 Mehdi Abaakouk
</pre>
314 120 Mehdi Abaakouk
315 109 Mehdi Abaakouk
Remplacer: 
316 112 Mehdi Abaakouk
<pre>
317 109 Mehdi Abaakouk
    <disk type='file' device='disk'>
318 109 Mehdi Abaakouk
      <driver name='qemu' type='raw' cache='none' io='native'/>
319 109 Mehdi Abaakouk
      <source file='/var/lib/ceph/osd/ceph-0/openstack.raw'/>
320 110 Mehdi Abaakouk
      <target dev='vda' bus='virtio'/>
321 109 Mehdi Abaakouk
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
322 97 Mehdi Abaakouk
    </disk>
323 97 Mehdi Abaakouk
</pre>
324 109 Mehdi Abaakouk
325 97 Mehdi Abaakouk
Par:
326 97 Mehdi Abaakouk
327 109 Mehdi Abaakouk
<pre>
328 109 Mehdi Abaakouk
    <disk type='network' device='disk'>
329 109 Mehdi Abaakouk
        <driver name='qemu' type='raw'/>
330 212 Mehdi Abaakouk
        <source protocol='rbd' name='disks/openstack-disk' />
331 97 Mehdi Abaakouk
        </source>
332 97 Mehdi Abaakouk
        <auth username='openstack-service'>
333 109 Mehdi Abaakouk
            <secret type='ceph' uuid='1fe74663-8dfa-486c-bb80-3bd94c90c967'/>
334 97 Mehdi Abaakouk
        </auth>
335 97 Mehdi Abaakouk
        <target dev='vda' bus='virtio'/>
336 97 Mehdi Abaakouk
        <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
337 97 Mehdi Abaakouk
    </disk>
338 97 Mehdi Abaakouk
</pre>
339 97 Mehdi Abaakouk
340 97 Mehdi Abaakouk
La clé ceph pour libvirt a déjà été installé par puppet pour avoir sont uuid:
341 97 Mehdi Abaakouk
342 97 Mehdi Abaakouk
<pre>
343 97 Mehdi Abaakouk
$ virsh secret-list
344 97 Mehdi Abaakouk
 UUID                                  Usage
345 97 Mehdi Abaakouk
--------------------------------------------------------------------------------
346 97 Mehdi Abaakouk
 1fe74663-8dfa-486c-bb80-3bd94c90c967  ceph client.openstack-service secret
347 97 Mehdi Abaakouk
</pre>
348 97 Mehdi Abaakouk
349 97 Mehdi Abaakouk
Puis on démarre
350 97 Mehdi Abaakouk
351 97 Mehdi Abaakouk
<pre>
352 97 Mehdi Abaakouk
$ virsh start openstack
353 97 Mehdi Abaakouk
</pre>
354 97 Mehdi Abaakouk
355 97 Mehdi Abaakouk
356 97 Mehdi Abaakouk
Ca marche !
357 97 Mehdi Abaakouk
358 97 Mehdi Abaakouk
<pre>
359 68 Mehdi Abaakouk
$ ssh openstack.t
360 68 Mehdi Abaakouk
X11 forwarding request failed on channel 0
361 68 Mehdi Abaakouk
362 68 Mehdi Abaakouk
  server: openstack.tetaneutral.net
363 102 Mehdi Abaakouk
  system: Debian jessie/sid, kernel 3.14-2-amd64, puppet 3.6.1
364 1 Mehdi Abaakouk
     cpu: 1/1 (QEMU Virtual CPU version 2.1.0)
365 102 Mehdi Abaakouk
  memory: 1.96 GB
366 1 Mehdi Abaakouk
367 102 Mehdi Abaakouk
    eth0: 52:54:00:90:d8:c7 / 89.234.156.249 / 2a01:6600:8083:f900::1
368 102 Mehdi Abaakouk
    eth1: 52:54:00:13:fa:13 / 192.168.3.100
369 68 Mehdi Abaakouk
370 68 Mehdi Abaakouk
 modules: openstack_node_common ttnn::server resolver checkmk::agent checkmk::client rsyslog::client rsyslog apt apt::update puppet nullmailer backup::client sexymotd 
371 68 Mehdi Abaakouk
                            _             _    
372 68 Mehdi Abaakouk
  ___  _ __   ___ _ __  ___| |_ __ _  ___| | __
373 68 Mehdi Abaakouk
 / _ \| '_ \ / _ \ '_ \/ __| __/ _` |/ __| |/ /
374 68 Mehdi Abaakouk
| (_) | |_) |  __/ | | \__ \ || (_| | (__|   < 
375 68 Mehdi Abaakouk
 \___/| .__/ \___|_| |_|___/\__\__,_|\___|_|\_\
376 68 Mehdi Abaakouk
      |_|                                      
377 68 Mehdi Abaakouk
Last login: Wed Aug 27 08:10:02 2014 from atoulouse-652-1-119-50.w2-6.abo.wanadoo.fr
378 68 Mehdi Abaakouk
root@openstack:~# 
379 68 Mehdi Abaakouk
380 68 Mehdi Abaakouk
</pre>
381 68 Mehdi Abaakouk
382 68 Mehdi Abaakouk
h2. Preparation des OSD pour ceph
383 68 Mehdi Abaakouk
384 68 Mehdi Abaakouk
h3. Cas général un disque entier:
385 68 Mehdi Abaakouk
386 158 Mehdi Abaakouk
<pre>
387 208 Mehdi Abaakouk
$ ceph-disk prepare --zap-disk --fs-type=ext4 /dev/sdX
388 199 Mehdi Abaakouk
$ smartctl --smart=on /dev/sdX  # Pour le monitoring.
389 194 Mehdi Abaakouk
$ ceph osd crush add osd.<ID> 0 root=default host=g3
390 194 Mehdi Abaakouk
ou pour les ssds:
391 1 Mehdi Abaakouk
$ ceph osd crush add osd.<ID> 0 root=ssd host=g3-ssd
392 194 Mehdi Abaakouk
393 197 Mehdi Abaakouk
$ /root/tools/ceph-reweight-osds.sh osd.<ID>
394 158 Mehdi Abaakouk
</pre>
395 68 Mehdi Abaakouk
396 1 Mehdi Abaakouk
h3. Cas particulier du SSD ou ce trouve l'OS
397 68 Mehdi Abaakouk
398 103 Mehdi Abaakouk
En général avec ceph, on donne un disque, ceph créé 2 partitions une pour le journal de l'OSD, l'autre pour les datas
399 1 Mehdi Abaakouk
mais pour le SSD de tetaneutral qui a aussi l'OS, voici la méthode
400 34 Mehdi Abaakouk
401 103 Mehdi Abaakouk
Création manuelle de la partition de data ceph /dev/sda2 ici
402 102 Mehdi Abaakouk
403 1 Mehdi Abaakouk
<pre>
404 1 Mehdi Abaakouk
$ fdisk /dev/sda
405 102 Mehdi Abaakouk
406 102 Mehdi Abaakouk
n
407 102 Mehdi Abaakouk
p
408 102 Mehdi Abaakouk
<enter>
409 102 Mehdi Abaakouk
<enter>
410 102 Mehdi Abaakouk
<enter>
411 102 Mehdi Abaakouk
<enter>
412 104 Mehdi Abaakouk
w
413 104 Mehdi Abaakouk
414 104 Mehdi Abaakouk
$ partprobe
415 104 Mehdi Abaakouk
</pre>
416 104 Mehdi Abaakouk
417 104 Mehdi Abaakouk
On prepare le disk comme normalement
418 105 Mehdi Abaakouk
419 104 Mehdi Abaakouk
<pre>
420 104 Mehdi Abaakouk
ceph-disk prepare /dev/sda2
421 207 Mehdi Abaakouk
ceph-disk activate --fs-type=ext4 /dev/sda2
422 104 Mehdi Abaakouk
</pre>
423 104 Mehdi Abaakouk
424 116 Mehdi Abaakouk
Le disque n'étant pas utilisé uniquement par ceph, le service ceph ne le chargera pas automatiquement:
425 207 Mehdi Abaakouk
Il faut ajouter le nom du device dans le /etc/rc.local pour qu'il lance:
426 116 Mehdi Abaakouk
427 116 Mehdi Abaakouk
<pre>
428 116 Mehdi Abaakouk
ceph-disk activate /dev/sda2
429 116 Mehdi Abaakouk
</pre>
430 116 Mehdi Abaakouk
431 170 Mehdi Abaakouk
h3. Suppression OSD:
432 116 Mehdi Abaakouk
433 116 Mehdi Abaakouk
<pre>
434 116 Mehdi Abaakouk
name="osd.2"
435 116 Mehdi Abaakouk
ceph osd out ${name}
436 116 Mehdi Abaakouk
/etc/init.d/ceph stop ${name}
437 116 Mehdi Abaakouk
ceph osd crush remove ${name}
438 116 Mehdi Abaakouk
ceph auth del ${name}
439 116 Mehdi Abaakouk
ceph osd rm ${name}
440 116 Mehdi Abaakouk
ceph osd tree
441 116 Mehdi Abaakouk
</pre>
442 116 Mehdi Abaakouk
443 116 Mehdi Abaakouk
h2. Configuration des Placements Groups des pools:
444 116 Mehdi Abaakouk
445 142 Mehdi Abaakouk
Par défaut les pools sont créés avec des placements groups à 8 (pg_num=8), 3 replicats, avec un tolérance à 2, si il manque des OSDs" 
446 116 Mehdi Abaakouk
447 116 Mehdi Abaakouk
Mais cette valeur (pg_num) défini le bon fonctionnement de ceph. Dans le cas standard (ie: 1 seul pool) la recette est facile: 
448 116 Mehdi Abaakouk
449 116 Mehdi Abaakouk
<pre>
450 116 Mehdi Abaakouk
               (OSDs * 100)
451 116 Mehdi Abaakouk
Total PGs = (  ------------  )
452 116 Mehdi Abaakouk
              OSD per object
453 116 Mehdi Abaakouk
</pre>
454 116 Mehdi Abaakouk
455 142 Mehdi Abaakouk
On arrondi à la puissance de 2 supérieurs. Mais dans notre cas 3 pools ce n'est pas si simple, les pools auront des cas d'utilisation différent:
456 116 Mehdi Abaakouk
457 116 Mehdi Abaakouk
Ma proposition de configuration:
458 107 Mehdi Abaakouk
* Pool ssds: il a 3 OSDs pour lui tout seul, on applique la recette magique: 3*100/3 ~= 128 pgs
459 1 Mehdi Abaakouk
* Pools images et disks: ils ont 3 OSDs à ce partager donc il faut répartir les 128 pgs. soit 32pgs et 96pgs (PS: il faut au moins 20pgs pour 3 réplicats)
460 69 Mehdi Abaakouk
461 1 Mehdi Abaakouk
Soit:
462 1 Mehdi Abaakouk
<pre>
463 79 Mehdi Abaakouk
ceph osd pool set ssds pg_num 128
464 1 Mehdi Abaakouk
ceph osd pool set images pg_num 32
465 1 Mehdi Abaakouk
ceph osd pool set disks pg_num 96
466 1 Mehdi Abaakouk
467 1 Mehdi Abaakouk
# attendre un peu qu'il y est plus de pg_create dans 'ceph -s'
468 121 Mehdi Abaakouk
ceph osd pool set ssds pgp_num 128  
469 121 Mehdi Abaakouk
ceph osd pool set images pgp_num 32
470 121 Mehdi Abaakouk
ceph osd pool set disks pgp_num 96
471 121 Mehdi Abaakouk
</pre>
472 1 Mehdi Abaakouk
473 107 Mehdi Abaakouk
474 1 Mehdi Abaakouk
475 107 Mehdi Abaakouk
_ref: http://ceph.com/docs/master/rados/operations/placement-groups/_
476 107 Mehdi Abaakouk
477 1 Mehdi Abaakouk
h2. Preparation du Pool SSD pour ceph 
478 107 Mehdi Abaakouk
479 107 Mehdi Abaakouk
Chaque machine se trouve dans 2 hosts, un host SSD et un host HARDDISK (même si en réalité les deux sont sur la même machine physique),
480 107 Mehdi Abaakouk
481 107 Mehdi Abaakouk
Ensuite on créé 2 object root un pour les hosts SSD et un autre pour les host HARDDISK
482 107 Mehdi Abaakouk
483 107 Mehdi Abaakouk
On créé ensuite 2 règles de stockage une qui envoie les objects vers le root SSD et l'autre vers le root HARDDISK
484 107 Mehdi Abaakouk
485 107 Mehdi Abaakouk
Cela permettra d'avoir de définir une règle différente suivant les pools ceph.
486 107 Mehdi Abaakouk
487 107 Mehdi Abaakouk
Niveau Openstack nous avons 3 pools:
488 107 Mehdi Abaakouk
* disks: Ce pool aura les disques de VM et les volumes attaché
489 107 Mehdi Abaakouk
* ssds: Ce pool contiendra les volumes sur ssd
490 107 Mehdi Abaakouk
* images: c'est la que seront stocké les images de VMs (glance).
491 122 Mehdi Abaakouk
492 122 Mehdi Abaakouk
h3. Configuration de la crushmap de ceph:
493 122 Mehdi Abaakouk
494 135 Mehdi Abaakouk
Il faut s'assurer que la crushmap n'est pas en mode automatique (c'est déjà configuré par puppet):
495 122 Mehdi Abaakouk
496 1 Mehdi Abaakouk
<pre>
497 135 Mehdi Abaakouk
[global]
498 135 Mehdi Abaakouk
osd crush update on start = false
499 135 Mehdi Abaakouk
</pre>
500 135 Mehdi Abaakouk
501 135 Mehdi Abaakouk
Création de l'arbre de rangement physique des SSD, l'arbre nommé 'default' sera donc celui des disques durs
502 135 Mehdi Abaakouk
503 135 Mehdi Abaakouk
<pre>
504 122 Mehdi Abaakouk
$ ceph osd crush add-bucket ssd root
505 122 Mehdi Abaakouk
$ ceph osd crush add-bucket g1-ssd host
506 122 Mehdi Abaakouk
$ ceph osd crush add-bucket g2-ssd host
507 122 Mehdi Abaakouk
$ ceph osd crush add-bucket g3-ssd host
508 1 Mehdi Abaakouk
$ ceph osd crush move g1-ssd root=ssd
509 1 Mehdi Abaakouk
$ ceph osd crush move g2-ssd root=ssd
510 1 Mehdi Abaakouk
$ ceph osd crush move g3-ssd root=ssd
511 107 Mehdi Abaakouk
$ ceph osd tree
512 107 Mehdi Abaakouk
# id	weight	type name	up/down	reweight
513 1 Mehdi Abaakouk
-5	0	root ssd
514 118 Mehdi Abaakouk
-6	0		host g1-ssd
515 118 Mehdi Abaakouk
-7	0		host g2-ssd
516 118 Mehdi Abaakouk
-8	0		host g3-ssd
517 118 Mehdi Abaakouk
-1	3	root default
518 117 Mehdi Abaakouk
-2	1		host g1
519 117 Mehdi Abaakouk
0	1			osd.0	up	1	
520 117 Mehdi Abaakouk
3	1			osd.3	up	1	
521 118 Mehdi Abaakouk
-3	1		host g2
522 118 Mehdi Abaakouk
1	1			osd.1	up	1	
523 107 Mehdi Abaakouk
4	1			osd.4	up	1	
524 107 Mehdi Abaakouk
-4	1		host g3
525 122 Mehdi Abaakouk
2	1			osd.2	up	1	
526 122 Mehdi Abaakouk
5	1			osd.5	up	1	
527 122 Mehdi Abaakouk
</pre>
528 122 Mehdi Abaakouk
529 122 Mehdi Abaakouk
530 122 Mehdi Abaakouk
On range les osd qui ont des disques SSD dans ce nouvel arbre.
531 122 Mehdi Abaakouk
532 122 Mehdi Abaakouk
<pre>
533 195 Mehdi Abaakouk
$ ceph osd crush add osd.3 0  root=ssd host=g1-ssd
534 195 Mehdi Abaakouk
$ ceph osd crush add osd.4 0  root=ssd host=g2-ssd
535 195 Mehdi Abaakouk
$ ceph osd crush add osd.5 0  root=ssd host=g3-ssd
536 195 Mehdi Abaakouk
537 122 Mehdi Abaakouk
# Ou si l'osd a déjà éte positionné une fois
538 195 Mehdi Abaakouk
$ ceph osd crush set osd.3 0  root=ssd host=g1-ssd
539 195 Mehdi Abaakouk
$ ceph osd crush set osd.4 0  root=ssd host=g2-ssd
540 195 Mehdi Abaakouk
$ ceph osd crush set osd.5 0  root=ssd host=g3-ssd
541 96 Mehdi Abaakouk
542 108 Mehdi Abaakouk
# Vérifier le résultat
543 107 Mehdi Abaakouk
$ ceph osd tree
544 96 Mehdi Abaakouk
# id	weight	type name	up/down	reweight
545 96 Mehdi Abaakouk
-5	3	root ssd
546 121 Mehdi Abaakouk
-6	1		host g1-ssd
547 96 Mehdi Abaakouk
3	1			osd.3	up	1	
548 107 Mehdi Abaakouk
-7	1		host g2-ssd
549 107 Mehdi Abaakouk
4	1			osd.4	up	1	
550 107 Mehdi Abaakouk
-8	1		host g3-ssd
551 1 Mehdi Abaakouk
5	1			osd.5	up	1	
552 1 Mehdi Abaakouk
-1	3	root default
553 1 Mehdi Abaakouk
-2	1		host g1
554 1 Mehdi Abaakouk
0	1			osd.0	up	1	
555 107 Mehdi Abaakouk
-3	1		host g2
556 107 Mehdi Abaakouk
1	1			osd.1	up	1	
557 107 Mehdi Abaakouk
-4	1		host g3
558 195 Mehdi Abaakouk
2	1			osd.2	up	1
559 195 Mehdi Abaakouk
560 195 Mehdi Abaakouk
Puis recalculer les poids des OSD:
561 195 Mehdi Abaakouk
$ /root/tools/ceph-reweight-osds.sh
562 107 Mehdi Abaakouk
</pre>
563 107 Mehdi Abaakouk
564 107 Mehdi Abaakouk
h3. Definition de la crushmap de ttnn
565 107 Mehdi Abaakouk
566 107 Mehdi Abaakouk
567 107 Mehdi Abaakouk
Une fois la crushmap modifié on créée et applique la règle sur le pool ssds:
568 107 Mehdi Abaakouk
569 107 Mehdi Abaakouk
<pre>
570 107 Mehdi Abaakouk
$ ceph osd crush rule create-simple ssd_replicated_ruleset ssd host firstn
571 107 Mehdi Abaakouk
$ ceph osd crush rule dump
572 107 Mehdi Abaakouk
[
573 107 Mehdi Abaakouk
    { "rule_id": 0,
574 107 Mehdi Abaakouk
      "rule_name": "replicated_ruleset",
575 1 Mehdi Abaakouk
      "ruleset": 0,
576 107 Mehdi Abaakouk
      "type": 1,
577 107 Mehdi Abaakouk
      "min_size": 1,
578 107 Mehdi Abaakouk
      "max_size": 10,
579 107 Mehdi Abaakouk
      "steps": [
580 107 Mehdi Abaakouk
            { "op": "take",
581 107 Mehdi Abaakouk
              "item": -1,
582 1 Mehdi Abaakouk
              "item_name": "default"},
583 121 Mehdi Abaakouk
            { "op": "chooseleaf_firstn",
584 1 Mehdi Abaakouk
              "num": 0,
585 1 Mehdi Abaakouk
              "type": "host"},
586 107 Mehdi Abaakouk
            { "op": "emit"}]},
587 1 Mehdi Abaakouk
    { "rule_id": 1,
588 1 Mehdi Abaakouk
      "rule_name": "ssd_replicated_ruleset",
589 107 Mehdi Abaakouk
      "ruleset": 1,
590 1 Mehdi Abaakouk
      "type": 1,
591 1 Mehdi Abaakouk
      "min_size": 1,
592 1 Mehdi Abaakouk
      "max_size": 10,
593 113 Mehdi Abaakouk
      "steps": [
594 114 Mehdi Abaakouk
            { "op": "take",
595 1 Mehdi Abaakouk
              "item": -5,
596 114 Mehdi Abaakouk
              "item_name": "ssd"},
597 113 Mehdi Abaakouk
            { "op": "chooseleaf_firstn",
598 113 Mehdi Abaakouk
              "num": 0,
599 113 Mehdi Abaakouk
              "type": "host"},
600 113 Mehdi Abaakouk
            { "op": "emit"}]}]
601 113 Mehdi Abaakouk
602 113 Mehdi Abaakouk
$ ceph osd pool set ssds crush_ruleset 1
603 113 Mehdi Abaakouk
</pre>
604 1 Mehdi Abaakouk
605 114 Mehdi Abaakouk
Il faut ensuite attendre que ceph redistribue les data comme on lui a demandé, on peut suivre l'avancement avec :
606 114 Mehdi Abaakouk
607 114 Mehdi Abaakouk
<pre>
608 114 Mehdi Abaakouk
ceph -s
609 114 Mehdi Abaakouk
</pre>
610 115 Mehdi Abaakouk
611 214 Laurent GUERBY
h2. Pool ceph erasure coding
612 214 Laurent GUERBY
613 219 Laurent GUERBY
h3. Creation erasure coded pool
614 214 Laurent GUERBY
615 215 Laurent GUERBY
En pratique on a 5 machines avec chacune au moins un rotationnel (le plus petit = 2 TB sur g3), on va creer un 4+1 qui devrait permettre le fonctionnement continu malgré la perte d'une machine :
616 215 Laurent GUERBY
617 218 Laurent GUERBY
Ajout des deux pools via puppet
618 218 Laurent GUERBY
https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster/revisions/master/entry/manifests/nodes/openstack.pp#L21
619 215 Laurent GUERBY
<pre>
620 218 Laurent GUERBY
$os_cinder_ceph_pools = ...
621 218 Laurent GUERBY
"ceph-ec4p1" => "ec4p1",
622 218 Laurent GUERBY
...
623 218 Laurent GUERBY
</pre>
624 1 Mehdi Abaakouk
625 1 Mehdi Abaakouk
<pre>
626 218 Laurent GUERBY
# pool erasure code
627 227 Laurent GUERBY
ceph osd erasure-code-profile set ec4p1profile k=4 m=1 ruleset-failure-domain=host
628 227 Laurent GUERBY
# Note: ruleset-failure-domain cannot be changed after creation, host will choose only one disk per host, other option is osd whith no such constraint
629 218 Laurent GUERBY
ceph osd pool create ec4p1 12 12 erasure ec4p1profile
630 215 Laurent GUERBY
631 215 Laurent GUERBY
# cache avec ec4p1c pool "normal" car le pool erasure code n'implémente pas les write partiels.
632 223 Laurent GUERBY
ceph osd pool create ec4p1c 12 12 replicated
633 1 Mehdi Abaakouk
634 1 Mehdi Abaakouk
# tuning du pool cache
635 225 Laurent GUERBY
ceph osd pool set ec4p1c size 3 
636 225 Laurent GUERBY
ceph osd pool set ec4p1c min_size 2
637 225 Laurent GUERBY
638 220 Laurent GUERBY
ceph osd pool set ec4p1c cache_target_dirty_ratio 0.4 # begin flushing modified (dirty) objects when they reach 40% of the cache pool’s capacity
639 220 Laurent GUERBY
ceph osd pool set ec4p1c cache_target_full_ratio 0.8 # begin flushing unmodified (clean) objects when they reach 80% of the cache pool’s capacity
640 1 Mehdi Abaakouk
ceph osd pool set ec4p1c target_max_bytes 1000000000 # to flush or evict at 1 GB = 1e9 bytes
641 223 Laurent GUERBY
ceph osd pool set ec4p1c target_max_objects 1000000000 # ?
642 222 Mehdi Abaakouk
ceph osd pool set ec4p1c hit_set_type bloom
643 1 Mehdi Abaakouk
ceph osd pool set ec4p1c hit_set_count 1
644 1 Mehdi Abaakouk
ceph osd pool set ec4p1c hit_set_period 3600
645 1 Mehdi Abaakouk
646 225 Laurent GUERBY
# mise en place du cache tier writeback overlay
647 225 Laurent GUERBY
ceph osd tier add ec4p1 ec4p1c
648 225 Laurent GUERBY
ceph osd tier cache-mode ec4p1c writeback
649 225 Laurent GUERBY
ceph osd tier set-overlay ec4p1 ec4p1c
650 225 Laurent GUERBY
651 225 Laurent GUERBY
# creation et attach d'un disque sur une VM
652 225 Laurent GUERBY
cinder create --volume-type ceph-ec4p1 --display-name apt.tetaneutral.net-disk-1 1024
653 225 Laurent GUERBY
nova volume-attach apt.tetaneutral.net 4663c1c1-e5e9-4684-9e55-bb2d9cc18ac8
654 1 Mehdi Abaakouk
</pre>
655 1 Mehdi Abaakouk
656 228 Laurent GUERBY
Exemple de creation de ec3p1 avec cache 500G ec3p1c
657 228 Laurent GUERBY
658 228 Laurent GUERBY
<pre>
659 228 Laurent GUERBY
ceph osd erasure-code-profile set ec3p1profile k=3 m=1 ruleset-failure-domain=host
660 228 Laurent GUERBY
ceph osd pool create ec3p1 12 12 erasure ec3p1profile
661 228 Laurent GUERBY
662 228 Laurent GUERBY
ceph osd pool create ec3p1c 12 12 replicated
663 228 Laurent GUERBY
ceph osd pool set ec3p1c size 3 
664 228 Laurent GUERBY
ceph osd pool set ec3p1c min_size 2
665 228 Laurent GUERBY
ceph osd pool set ec3p1c cache_target_dirty_ratio 0.4 
666 228 Laurent GUERBY
ceph osd pool set ec3p1c cache_target_full_ratio 0.8 
667 228 Laurent GUERBY
ceph osd pool set ec3p1c target_max_bytes 500000000000 
668 228 Laurent GUERBY
ceph osd pool set ec3p1c target_max_objects 500000000000 
669 228 Laurent GUERBY
ceph osd pool set ec3p1c hit_set_type bloom
670 228 Laurent GUERBY
ceph osd pool set ec3p1c hit_set_count 1
671 228 Laurent GUERBY
ceph osd pool set ec3p1c hit_set_period 3600
672 228 Laurent GUERBY
673 228 Laurent GUERBY
ceph osd tier add ec3p1 ec3p1c
674 228 Laurent GUERBY
ceph osd tier cache-mode ec3p1c writeback
675 228 Laurent GUERBY
ceph osd tier set-overlay ec3p1 ec3p1c
676 228 Laurent GUERBY
677 228 Laurent GUERBY
cinder create --volume-type ceph-ec3p1 --display-name utopialab.tetaneutral.net-disk-1 8192
678 228 Laurent GUERBY
nova volume-attach utopia.tetaneutral.net xxxx
679 228 Laurent GUERBY
</pre>
680 228 Laurent GUERBY
681 219 Laurent GUERBY
h3. Erasure URL
682 219 Laurent GUERBY
683 1 Mehdi Abaakouk
http://www.spinics.net/lists/ceph-devel/msg20920.html
684 1 Mehdi Abaakouk
http://ceph.com/docs/master/rados/operations/cache-tiering/
685 1 Mehdi Abaakouk
686 1 Mehdi Abaakouk
An erasure encoded pool cannot be accessed directly using rbd. For this
687 1 Mehdi Abaakouk
reason we need a cache pool and an erasure pool. This not only allows
688 1 Mehdi Abaakouk
supporting rbd but increases performance.
689 219 Laurent GUERBY
690 219 Laurent GUERBY
http://ceph.com/docs/master/dev/erasure-coded-pool/#interface
691 219 Laurent GUERBY
692 219 Laurent GUERBY
Creation "ecpool" "ecruleset" "myprofile"
693 219 Laurent GUERBY
694 219 Laurent GUERBY
<pre>
695 219 Laurent GUERBY
ceph osd pool create ecpool 12 12 erasure
696 219 Laurent GUERBY
ceph osd crush rule create-erasure ecruleset
697 219 Laurent GUERBY
ceph osd pool create ecpool 12 12 erasure default ecruleset
698 219 Laurent GUERBY
ceph osd erasure-code-profile set myprofile ruleset-failure-domain=osd
699 219 Laurent GUERBY
ceph osd erasure-code-profile get myprofile
700 219 Laurent GUERBY
ceph osd pool create ecpool 12 12 erasure myprofile
701 219 Laurent GUERBY
ceph osd erasure-code-profile set myprofile k=3 m=1
702 219 Laurent GUERBY
ceph osd erasure-code-profile get myprofile
703 219 Laurent GUERBY
ceph osd pool create ecpool 12 12 erasure myprofile
704 219 Laurent GUERBY
705 219 Laurent GUERBY
ceph osd erasure-code-profile ls
706 219 Laurent GUERBY
ceph osd erasure-code-profile get default
707 219 Laurent GUERBY
ceph osd erasure-code-profile rm myprofile
708 219 Laurent GUERBY
ceph osd erasure-code-profile set myprofile ruleset-root=ssd
709 219 Laurent GUERBY
</pre>
710 217 Laurent GUERBY
711 205 Mehdi Abaakouk
h2. Activer le cache-tiering  /!\/!\ Plus utilisé pas encore assez stable /!\/!\ 
712 167 Mehdi Abaakouk
713 167 Mehdi Abaakouk
http://ceph.com/docs/master/rados/operations/cache-tiering/
714 167 Mehdi Abaakouk
715 210 Mehdi Abaakouk
h3. Preparation
716 210 Mehdi Abaakouk
717 167 Mehdi Abaakouk
<pre>
718 167 Mehdi Abaakouk
ceph mkpool ssd-cache
719 175 Mehdi Abaakouk
ceph osd pool set ssd-cache pg_num 128
720 175 Mehdi Abaakouk
ceph osd pool set ssd-cache pgp_num 128
721 175 Mehdi Abaakouk
ceph osd pool set ssds crush_ruleset 1
722 167 Mehdi Abaakouk
ceph osd tier add disks ssd-cache
723 167 Mehdi Abaakouk
ceph osd tier cache-mode ssd-cache writeback
724 167 Mehdi Abaakouk
ceph osd tier set-overlay disks ssd-cache
725 173 Mehdi Abaakouk
ceph osd pool set ssd-cache target_max_bytes $[15 * 1024 * 1024 * 1024]
726 221 Mehdi Abaakouk
ceph osd pool set ssd-cache target_max_objects 3000000
727 1 Mehdi Abaakouk
728 173 Mehdi Abaakouk
# http://lists.ceph.com/pipermail/ceph-users-ceph.com/2014-August/042174.html
729 173 Mehdi Abaakouk
ceph osd pool set ssd-cache cache_target_dirty_ratio 0.4
730 173 Mehdi Abaakouk
ceph osd pool set ssd-cache cache_target_full_ratio 0.8
731 173 Mehdi Abaakouk
ceph osd pool set ssd-cache hit_set_type bloom
732 176 Mehdi Abaakouk
ceph osd pool set ssd-cache hit_set_count 1
733 173 Mehdi Abaakouk
ceph osd pool set ssd-cache hit_set_period 3600
734 174 Mehdi Abaakouk
735 174 Mehdi Abaakouk
ceph osd dump -f json-pretty | grep ssd-cache -A40 -B1
736 210 Mehdi Abaakouk
</pre>
737 210 Mehdi Abaakouk
738 210 Mehdi Abaakouk
h3. Gestion du cache
739 210 Mehdi Abaakouk
740 210 Mehdi Abaakouk
http://lists.ceph.com/pipermail/ceph-users-ceph.com/2014-August/042018.html
741 210 Mehdi Abaakouk
742 210 Mehdi Abaakouk
<pre>
743 210 Mehdi Abaakouk
rados -p ssd-cache cache-flush-evict-all
744 210 Mehdi Abaakouk
# puis control-c
745 210 Mehdi Abaakouk
ceph df|grep ssd-cache
746 173 Mehdi Abaakouk
</pre>
747 167 Mehdi Abaakouk
748 179 Laurent GUERBY
h2. Optimisations
749 179 Laurent GUERBY
750 179 Laurent GUERBY
via Loic :
751 179 Laurent GUERBY
http://ceph.com/docs/giant/rados/configuration/osd-config-ref/
752 179 Laurent GUERBY
dans /etc/ceph/ceph.conf
753 200 Loic Dachary
osd-disk-thread-ioprio-class = idle
754 200 Loic Dachary
osd-disk-thread-ioprio-priority = 7   
755 179 Laurent GUERBY
de façon hebdomadaire ceph va examiner l'etat des objets (scrub) et faire plein d'IO pour ça. Ce parametre dit que ces IO passent en dernier. Ca n'affecte pas les IO normales faites via rbd.
756 179 Laurent GUERBY
757 154 Laurent GUERBY
h2. Migration IP ceph
758 154 Laurent GUERBY
759 154 Laurent GUERBY
Au besoin pour passer cluster de test a dev
760 154 Laurent GUERBY
* http://ceph.com/docs/master/rados/operations/add-or-rm-mons/#changing-a-monitor-s-ip-address-the-messy-way
761 1 Mehdi Abaakouk
* http://ceph.com/docs/master/rados/operations/add-or-rm-mons/#changing-a-monitor-s-ip-address-the-right-way
762 184 Mehdi Abaakouk
763 184 Mehdi Abaakouk
h2. Configuration des Policies:
764 184 Mehdi Abaakouk
765 196 Mehdi Abaakouk
Les rules modifiées /etc/{nova,cinder,neutron,glance}/policy.json sont ici:
766 184 Mehdi Abaakouk
767 196 Mehdi Abaakouk
http://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/openstack-tools/revisions/master/show/policy