Gentoo Archives: gentoo-user-ru

From: Taz <taz.inside@×××××.com>
To: gentoo-user-ru@l.g.o
Subject: [gentoo-user-ru] Re: [gentoo-user-ru] Re: [gentoo-user-ru] Re: [gentoo-user-ru] Re: [gentoo-user-ru] Два инстанса Sphinx
Date: Thu, 06 Jun 2013 19:10:25
Message-Id: CA+0W4Nk-pNOXe=Dizdq2-QpO3Rje6Kw2-G9DjZf+ashz8mVYBw@mail.gmail.com
In Reply to: [gentoo-user-ru] Re: [gentoo-user-ru] Re: [gentoo-user-ru] Re: [gentoo-user-ru] Два инстанса Sphinx by Sergey Popov
1 Ага, более того, это типичная для генты практика.
2 On Jun 6, 2013 10:55 PM, "Sergey Popov" <pinkbyte@g.o> wrote:
3
4 > 06.06.2013 21:23, Андрей Буров пишет:
5 > > Для первого у Вас должно быть
6 > > start-stop-daemon --stop --pidfile /run/searchd-first.pid
7 > > для второго:
8 > > start-stop-daemon --stop --pidfile /run/searchd-second.pid
9 > >
10 > > start-stop-daemon --stop --exec /usr/bin/searchd и должен убивать
11 > > Все searchd
12 > >
13 > >
14 > > 2013/6/6 Sergey Kobzar <sergey.kobzar@××××.ru
15 > > <mailto:sergey.kobzar@××××.ru>>
16 > >
17 > > On 06/06/13 10:02, Андрей Буров wrote:
18 > >
19 > > Доброго времени суток
20 > > Поменяйте в скриптах:
21 > > start:
22 > > start-stop-daemon --start --make-pidfile --pidfile
23 > > /var/run/sphinx-test.pid --exec /usr/bin/searchd -- --config
24 > > /etc/sphinx/sphinx-test.conf
25 > >
26 > > stop:
27 > > start-stop-daemon --stop --pidfile /var/run/sphinx-test.pid
28 > >
29 > >
30 > > Сделал. Все-равно /etc/init.d/searchd stop останавливает 2 процесса.
31 > >
32 > > После старта (запускаются демоны разными скриптами):
33 > > 21467 ? S 0:00 /usr/bin/searchd
34 > > 21468 ? Sl 0:00 /usr/bin/searchd
35 > > 21485 ? S 0:00 /usr/bin/searchd --config
36 > > /etc/sphinx/sphinx-test.conf
37 > > 21486 ? Sl 0:18 /usr/bin/searchd --config
38 > > /etc/sphinx/sphinx-test.conf
39 > >
40 > >
41 > > Оригинальный скрипт /etc/init.d/searchd:
42 > > #!/sbin/runscript
43 > > # Copyright 1999-2004 Gentoo Foundation
44 > > # Distributed under the terms of the GNU General Public License v2
45 > > # $Header:
46 > > /var/cvsroot/gentoo-x86/app-__misc/sphinx/files/searchd.rc,v 1.1
47 > > 2009/11/05 15:41:56 graaff Exp $
48 > >
49 > >
50 > > depend() {
51 > > need net
52 > > use logger
53 > > }
54 > >
55 > > checkconfig() {
56 > > if [ ! -f /etc/sphinx/sphinx.conf ] ; then
57 > > eerror "Please create /etc/sphinx/sphinx.conf"
58 > >
59 > > eerror "Sample conf: /etc/sphinx/sphinx.conf.dist"
60 > > return 1
61 > > fi
62 > > return 0
63 > > }
64 > >
65 > > start() {
66 > > checkconfig || return $?
67 > >
68 > > ebegin "Starting sphinx searchd"
69 > > start-stop-daemon --start --exec /usr/bin/searchd
70 > > eend $? "Failed to start sphinx searchd"
71 > > }
72 > >
73 > > stop() {
74 > > ebegin "Stopping sphinx searchd"
75 > > start-stop-daemon --stop --exec /usr/bin/searchd
76 > > eend $? "Failed to stop sphinx searchd"
77 > > }
78 > >
79 > > Скрипт для второго инстанса /etc/init.d/searchd-test:
80 > > #!/sbin/runscript
81 > >
82 > >
83 > >
84 > > depend() {
85 > > need net
86 > > use logger
87 > > }
88 > >
89 > > checkconfig() {
90 > > if [ ! -f /etc/sphinx/sphinx-test.conf ]; then
91 > > eerror "Please create /etc/sphinx/sphinx-test.conf"
92 > > eerror "Sample conf: /etc/sphinx/sphinx.conf.dist"
93 > > return 1
94 > > fi
95 > > return 0
96 > > }
97 > >
98 > > start() {
99 > > checkconfig || return $?
100 > >
101 > > ebegin "Starting sphinx searchd"
102 > > start-stop-daemon --start --make-pidfile --pidfile
103 > > /run/searchd-test.pid --exec /usr/bin/searchd -- --config
104 > > /etc/sphinx/sphinx-test.conf
105 > >
106 > > eend $? "Failed to start sphinx searchd"
107 > > }
108 > >
109 > > stop() {
110 > > ebegin "Stopping sphinx searchd"
111 > > start-stop-daemon --stop --pidfile /run/searchd-test.pid
112 > >
113 > > eend $? "Failed to stop sphinx searchd"
114 > > }
115 > >
116 > >
117 > > Может первому первому скрпту надо сказат --make-pidfile --pidfile
118 > > /run/searchd-test.pid?
119 > >
120 > > Кстати, а зачем --make-pidfile, если демон сам их создает:
121 > >
122 > > # cat /etc/sphinx/sphinx.conf | grep pid
123 > > pid_file = /run/searchd.pid
124 > >
125 > > # cat /etc/sphinx/sphinx-test.conf | grep pid
126 > > pid_file = /run/searchd-test.pid
127 > >
128 > > ?
129 >
130 > Извините, что встреваю, но данное действие можно сделать одним
131 > init-скриптом и симлинком на него(оригинальный скрипт, понятное дело
132 > прийдется изменить). conf.d файла нужно будет 2(например sphinx и
133 > sphinx.test, соответственно скрипт будет sphinx а симлинк - sphinx.test.
134 > Разруливать всё это можно будет через переменную ${SVCNAME}). А патч
135 > отправить на bugs.gentoo.org. Если активности в баге особой не будет -
136 > можно будет аккуратно пнуть мэйнтэйнеров. Я поспособствую ;-)
137 >
138 > В чем преимущество? В том, что в данной схеме можно будет запустить
139 > 3,5,10,сколько_позволит_железо копий sphinx
140 >
141 > --
142 > Best regards, Sergey Popov
143 > Gentoo Linux Developer
144 > Desktop-effects project lead
145 >
146 >