Gentoo Archives: gentoo-server

From: "Francesco R." <vivo@g.o>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] mysql upgrade process
Date: Mon, 24 Oct 2005 11:31:45
Message-Id: 200510231505.41560.vivo@gentoo.org
In Reply to: [gentoo-server] mysql upgrade process by Ben Munat
1 Alle 02:12, domenica 23 ottobre 2005, Ben Munat ha scritto:
2 > I was thinking about diverging from the mysql upgrade process
3 > described at
4 >
5 > http://www.gentoo.org/doc/en/mysql-upgrading.xml
6 >
7 > by one small bit. I'd rather not have the half-hour or so downtime
8 > while compiling mysql, so I was hoping to (after backing up my data)
9 > "emerge --buildpkg mysql" to get the 4.1 package all built. Then I'd
10 > stop mysql 4.0, unmerge it, "emerge --usepkgonly mysql" and restore
11 > my data.
12 >
13 > However, I have a feeling it won't work because the 4.1 ebuild
14 > probably checks for the existence of 4.0 on the system. If that's the
15 > case, could I maybe do the "export MYSQL_STRAIGHT_UPGRADE=1" step
16 > from the straight upgrade instructions?
17 >
18 > Of course, I'm not keen on doing any of this if there's some reason
19 > that vpopmail is not getting rebuilt with libmysqlclient.so.14...
20 > anyone have any luck with that yet?
21
22 ==============
23 What I'm going to describe here has never been tested, take it with
24 care.
25 Discussion of the following procedure should be nice, the beaty of
26 opensource also is that 100 brains are always better than one.
27 ==============
28
29 C: chroot steps
30 M: main system
31
32 C: Create a chroot, stage3 may suffice.
33 C: emerge mysql-4.1
34 C: change my.cnf :
35 port = 3307
36 server-id = 37
37
38 M: Flush tables with read lock or better, stop the server
39 M:C: copy the datadir in the chroot
40 (maybe cp -a /var/lib/mysql /chroot/var/lib/mysql)
41
42 optional:
43 If someting is going to _write_ in the time to come you will need to
44 setup the 4.1 server as slave (that's why there is the server-id = 37).
45 The procedure on how to do so is well documented on mysql web site.
46
47 M: release the lock or restart the server
48 C: start the server, may be as a slave of M:server, take a look at the
49 section STRAIGHT_UPGRADE
50 C: check consistence of data, check the cardinality of the indexes,
51 whatever come in mind.
52
53 M: for every mysql linked application you are using:
54 change the connection settings to work with
55 host=127.0.0.1
56 port=3307
57 use 127.0.0.1 instead of "localhost", otherwise mysql clients
58 use the sockets by default
59 hint: take a look at the output of the command
60 diff -Naur \
61 /usr/portage/dev-db/mysql/files/my.cnf-4.0.24-r1 \
62 /etc/mysql/my.cnf
63 Will show differences between the base and your my.cnf
64 M: no one is using this server right?
65 M: save somewhere /usr/lib/libmysqlclient*.so.1*
66 M: stop the server, unmerge it, emerge mysql-4.1
67 M: restore libmysqlclient*.so.1* in /usr/lib/
68 M: for every mysql linked application you are using:
69 emerge --onlydeps --one-shot cat/application
70 emerge --buildpkgonly cat/application
71 stop it
72 emerge --usepkgonly cat/application
73 start it
74 M: revdep-rebuild -pv --library=libmysqlclient.so.12
75 this will show a list of packages that still need to be emerged
76
77 Now you've two choices:
78 1) Leave the C:server in the chroot and so have it isolated from all the
79 other application and emerges.
80 In case you chose this road
81 mount -obind /chroot/var/run/mysql /var/run/mysql
82 so your apps still can access the server through host=localhost, using
83 the socket access, that's faster
84
85 2) the other is to bring again the server in the M: system, the
86 procedure to move it is the same as the previous one, reverting the cp
87 -a order.
88
89 Change every client setup to point to the right server.
90
91 Best regards,
92 Francesco
93 --
94 gentoo-server@g.o mailing list