天天看點

【原創】源碼安裝 Atlas-1.0.3 遇到的問題以及解決辦法

===== 

按照安裝說明,atlas-1.0.3 的安裝有如下依賴項: 

glib(2.32.x)、libevent(1.4以上)、lua(5.1.x)、openssl(0.9.8以上) 

基本執行指令如下: 

./bootstrap.sh #可能需要修改其中的路徑 

make 

sudo make install 

依賴項的安裝不做詳細說明,假設已經全部安裝好了。 

=====

1. 執行   bootstrap.sh 

下面是源碼包中提供的 bootstrap.sh 腳本的内容: 

<a href="http://my.oschina.net/moooofly/blog/178786#">?</a>

1

2

3

4

5

6

7

<code>[root@betty atlas-1.0.3]</code><code># vi bootstrap.sh</code>

<code>#!/bin/sh</code>

<code>base=$(</code><code>cd</code> <code>"$(dirname "</code><code>$0</code><code>")"</code><code>;</code><code>pwd</code><code>)</code>

<code>cd</code> <code>$base</code>

<code>pkg_config_path=</code><code>/usr/local/lib/pkgconfig</code> <code>.</code><code>/configure</code> <code>--with-mysql=</code><code>/usr</code> <code>--prefix=</code><code>/usr/local/mysql-proxy</code> <code>cflags=</code><code>"-dhave_lua_h -o2"</code> <code>ldflags=</code><code>"-lm -ldl -lcrypto"</code>

<code>lua_cflags=</code><code>"-i/usr/local/include/"</code> <code>lua_libs=</code><code>"-l/usr/local/lib -llua"</code>

運作該腳本會報出如下的錯誤資訊:

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

<code>[root@betty atlas-1.0.3]</code><code># ./bootstrap.sh</code>

<code>checking build system</code><code>type</code><code>... x86_64-unknown-linux-gnu</code>

<code>checking host system</code><code>type</code><code>... x86_64-unknown-linux-gnu</code>

<code>checking target system</code><code>type</code><code>... x86_64-unknown-linux-gnu</code>

<code>checking</code><code>for</code> <code>a bsd-compatible</code><code>install</code><code>...</code><code>/usr/bin/install</code> <code>-c</code>

<code>checking whether build environment is sane...</code><code>yes</code>

<code>checking</code><code>for</code> <code>a thread-safe</code><code>mkdir</code> <code>-p...</code><code>/bin/mkdir</code> <code>-p</code>

<code>checking</code><code>for</code> <code>gawk</code><code>...</code><code>gawk</code>

<code>checking whether</code><code>make</code> <code>sets $(make)...</code><code>yes</code>

<code>checking whether to</code><code>enable</code> <code>maintainer-specific portions of makefiles... no</code>

<code>checking</code><code>for</code> <code>style of include used by</code><code>make</code><code>... gnu</code>

<code>checking</code><code>for</code> <code>gcc</code><code>...</code><code>gcc</code>

<code>checking</code><code>for</code> <code>c compiler default output</code><code>file</code> <code>name... a.out</code>

<code>checking whether the c compiler works...</code><code>yes</code>

<code>checking whether we are cross compiling... no</code>

<code>checking</code><code>for</code> <code>suffix of executables...</code>

<code>checking</code><code>for</code> <code>suffix of object files... o</code>

<code>checking whether we are using the gnu c compiler...</code><code>yes</code>

<code>checking whether</code><code>gcc</code> <code>accepts -g...</code><code>yes</code>

<code>checking</code><code>for</code> <code>gcc</code> <code>option to accept iso c89... none needed</code>

<code>checking dependency style of</code><code>gcc</code><code>... gcc3</code>

<code>checking how to run the c preprocessor...</code><code>gcc</code> <code>-e</code>

<code>checking</code><code>for</code> <code>grep</code> <code>that handles long lines and -e...</code><code>/bin/grep</code>

<code>checking</code><code>for</code> <code>egrep</code><code>...</code><code>/bin/grep</code> <code>-e</code>

<code>checking</code><code>for</code> <code>ansi c header files...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/types</code><code>.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/stat</code><code>.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>stdlib.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>string.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>memory.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>strings</code><code>.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>inttypes.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>stdint.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>unistd.h...</code><code>yes</code>

<code>checking minix</code><code>/config</code><code>.h usability... no</code>

<code>checking minix</code><code>/config</code><code>.h presence... no</code>

<code>checking</code><code>for</code> <code>minix</code><code>/config</code><code>.h... no</code>

<code>checking whether it is safe to define __extensions__...</code><code>yes</code>

<code>checking</code><code>for</code> <code>library containing strerror... none required</code>

<code>checking</code><code>for</code> <code>gcc</code><code>... (cached)</code><code>gcc</code>

<code>checking whether we are using the gnu c compiler... (cached)</code><code>yes</code>

<code>checking whether</code><code>gcc</code> <code>accepts -g... (cached)</code><code>yes</code>

<code>checking</code><code>for</code> <code>gcc</code> <code>option to accept iso c89... (cached) none needed</code>

<code>checking dependency style of</code><code>gcc</code><code>... (cached) gcc3</code>

<code>checking</code><code>for</code> <code>a</code><code>sed</code> <code>that does not truncate output...</code><code>/bin/sed</code>

<code>checking</code><code>for</code> <code>fgrep</code><code>...</code><code>/bin/grep</code> <code>-f</code>

<code>checking</code><code>for</code> <code>ld used by</code><code>gcc</code><code>...</code><code>/usr/bin/ld</code>

<code>checking</code><code>if</code> <code>the linker (</code><code>/usr/bin/ld</code><code>) is gnu ld...</code><code>yes</code>

<code>checking</code><code>for</code> <code>gawk</code><code>... (cached)</code><code>gawk</code>

<code>checking</code><code>for</code> <code>flex... flex</code>

<code>checking lex output</code><code>file</code> <code>root... lex.yy</code>

<code>checking lex library... -lfl</code>

<code>checking whether yytext is a pointer...</code><code>yes</code>

<code>checking whether</code><code>ln</code> <code>-s works... no, using</code><code>cp</code> <code>-p</code>

<code>checking</code><code>for</code> <code>a</code><code>sed</code> <code>that does not truncate output... (cached)</code><code>/bin/sed</code>

<code>checking whether</code><code>make</code> <code>sets $(make)... (cached)</code><code>yes</code>

<code>checking whether</code><code>gcc</code> <code>and cc understand -c and -o together...</code><code>yes</code>

<code>checking</code><code>for</code> <code>function</code> <code>prototypes...</code><code>yes</code>

<code>checking</code><code>for</code> <code>string.h... (cached)</code><code>yes</code>

<code>checking whether byte ordering is bigendian... no</code>

<code>checking</code><code>for</code> <code>bsd- or ms-compatible name lister (nm)...</code><code>/usr/bin/nm</code> <code>-b</code>

<code>checking the name lister (</code><code>/usr/bin/nm</code> <code>-b) interface... bsd nm</code>

<code>checking the maximum length of</code><code>command</code> <code>line arguments... 98304</code>

<code>checking whether the shell understands some xsi constructs...</code><code>yes</code>

<code>checking whether the shell understands</code><code>"+="</code><code>...</code><code>yes</code>

<code>checking</code><code>for</code> <code>/usr/bin/ld</code> <code>option to reload object files... -r</code>

<code>checking</code><code>for</code> <code>objdump</code><code>...</code><code>objdump</code>

<code>checking how to recognize dependent libraries... pass_all</code>

<code>checking</code><code>for</code> <code>ar... ar</code>

<code>checking</code><code>for</code> <code>strip... strip</code>

<code>checking</code><code>for</code> <code>ranlib... ranlib</code>

<code>checking</code><code>command</code> <code>to parse</code><code>/usr/bin/nm</code> <code>-b output from</code><code>gcc</code> <code>object... ok</code>

<code>checking</code><code>for</code> <code>dlfcn.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>objdir... .libs</code>

<code>checking</code><code>if</code> <code>gcc</code> <code>supports -fno-rtti -fno-exceptions... no</code>

<code>checking</code><code>for</code> <code>gcc</code> <code>option to produce pic... -fpic -dpic</code>

<code>checking</code><code>if</code> <code>gcc</code> <code>pic flag -fpic -dpic works...</code><code>yes</code>

<code>checking</code><code>if</code> <code>gcc</code> <code>static flag -static works...</code><code>yes</code>

<code>checking</code><code>if</code> <code>gcc</code> <code>supports -c -o</code><code>file</code><code>.o...</code><code>yes</code>

<code>checking</code><code>if</code> <code>gcc</code> <code>supports -c -o</code><code>file</code><code>.o... (cached)</code><code>yes</code>

<code>checking whether the</code><code>gcc</code> <code>linker (</code><code>/usr/bin/ld</code> <code>-m elf_x86_64) supports shared libraries...</code><code>yes</code>

<code>checking whether -lc should be explicitly linked</code><code>in</code><code>... no</code>

<code>checking dynamic linker characteristics... gnu</code><code>/linux</code> <code>ld.so</code>

<code>checking how to hardcode library paths into programs... immediate</code>

<code>checking whether stripping libraries is possible...</code><code>yes</code>

<code>checking</code><code>if</code> <code>libtool supports shared libraries...</code><code>yes</code>

<code>checking whether to build shared libraries...</code><code>yes</code>

<code>checking whether to build static libraries... no</code>

<code>checking shared library path variable... ld_library_path</code>

<code>checking lua module suffix... so</code>

<code>checking plugin suffix... so</code>

<code>checking</code><code>for</code> <code>ansi c header files... (cached)</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/wait</code><code>.h that is posix.1 compatible...</code><code>yes</code>

<code>checking arpa</code><code>/inet</code><code>.h usability...</code><code>yes</code>

<code>checking arpa</code><code>/inet</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>arpa</code><code>/inet</code><code>.h...</code><code>yes</code>

<code>checking netinet</code><code>/in</code><code>.h usability...</code><code>yes</code>

<code>checking netinet</code><code>/in</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>netinet</code><code>/in</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/filio</code><code>.h usability... no</code>

<code>checking sys</code><code>/filio</code><code>.h presence... no</code>

<code>checking</code><code>for</code> <code>sys</code><code>/filio</code><code>.h... no</code>

<code>checking sys</code><code>/socket</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/socket</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/socket</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/param</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/param</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/param</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/time</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/time</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/time</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/un</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/un</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/un</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/uio</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/uio</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/uio</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/ioctl</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/ioctl</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/ioctl</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/resource</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/resource</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/resource</code><code>.h...</code><code>yes</code>

<code>checking</code><code>pwd</code><code>.h usability...</code><code>yes</code>

<code>checking</code><code>pwd</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>pwd</code><code>.h...</code><code>yes</code>

<code>checking signal.h usability...</code><code>yes</code>

<code>checking signal.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>signal.h...</code><code>yes</code>

<code>checking fcntl.h usability...</code><code>yes</code>

<code>checking fcntl.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>fcntl.h...</code><code>yes</code>

<code>checking libproc.h usability... no</code>

<code>checking libproc.h presence... no</code>

<code>checking</code><code>for</code> <code>libproc.h... no</code>

<code>checking valgrind</code><code>/valgrind</code><code>.h usability... no</code>

<code>checking valgrind</code><code>/valgrind</code><code>.h presence... no</code>

<code>checking</code><code>for</code> <code>valgrind</code><code>/valgrind</code><code>.h... no</code>

<code>checking syslog.h usability...</code><code>yes</code>

<code>checking syslog.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>syslog.h...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/time</code><code>.h... (cached)</code><code>yes</code>

<code>checking</code><code>time</code><code>.h usability...</code><code>yes</code>

<code>checking</code><code>time</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>time</code><code>.h...</code><code>yes</code>

<code>checking asm</code><code>/msr</code><code>.h usability... no</code>

<code>checking asm</code><code>/msr</code><code>.h presence...</code><code>yes</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h: present but cannot be compiled</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h:     check</code><code>for</code> <code>missing prerequisite headers?</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h: see the autoconf documentation</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h:     section</code><code>"present but cannot be compiled"</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h: proceeding with the preprocessor's result</code>

<code>configure: warning: asm</code><code>/msr</code><code>.h:</code><code>in</code> <code>the future, the compiler will take precedence</code>

<code>configure: warning:    </code><code>## ------------------------------------------------------ ##</code>

<code>configure: warning:    </code><code>## report this to [email protected] ##</code>

<code>checking</code><code>for</code> <code>asm</code><code>/msr</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/timeb</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/timeb</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/timeb</code><code>.h...</code><code>yes</code>

<code>checking sys</code><code>/times</code><code>.h usability...</code><code>yes</code>

<code>checking sys</code><code>/times</code><code>.h presence...</code><code>yes</code>

<code>checking</code><code>for</code> <code>sys</code><code>/times</code><code>.h...</code><code>yes</code>

<code>checking ia64intrin.h usability... no</code>

<code>checking ia64intrin.h presence... no</code>

<code>checking</code><code>for</code> <code>ia64intrin.h... no</code>

<code>checking</code><code>for</code> <code>rdtscll... no</code>

<code>checking</code><code>for</code> <code>ftime...</code><code>yes</code>

<code>checking</code><code>for</code> <code>times</code><code>...</code><code>yes</code>

<code>checking</code><code>for</code> <code>clock_gettime... no</code>

<code>checking</code><code>for</code> <code>get_hrtime... no</code>

<code>checking</code><code>for</code> <code>read_real_time... no</code>

<code>checking</code><code>for</code> <code>gettimeofday...</code><code>yes</code>

<code>checking</code><code>for</code> <code>time</code><code>...</code><code>yes</code>

<code>checking</code><code>for</code> <code>wait4...</code><code>yes</code>

<code>checking cc is sun cc... no</code>

<code>checking</code><code>for</code> <code>an ansi c-conforming const...</code><code>yes</code>

<code>checking</code><code>for</code> <code>inline... inline</code>

<code>checking whether char is unsigned... no</code>

<code>checking</code><code>return</code> <code>type</code> <code>of signal handlers... void</code>

<code>checking whether lstat dereferences a</code><code>symlink</code> <code>specified with a trailing slash... no</code>

<code>checking whether stat accepts an empty string... no</code>

<code>checking</code><code>for</code> <code>strftime...</code><code>yes</code>

<code>checking</code><code>for</code> <code>library containing socket... none required</code>

<code>checking</code><code>for</code> <code>library containing gethostbyname... none required</code>

<code>checking</code><code>for</code> <code>library containing hstrerror... none required</code>

<code>checking</code><code>for</code> <code>socklen_t...</code><code>yes</code>

<code>checking</code><code>for</code> <code>ulong...</code><code>yes</code>

<code>checking</code><code>for</code> <code>ulong_t... no</code>

<code>checking</code><code>for</code> <code>mysql support...</code><code>yes</code>

<code>checking</code><code>for</code> <code>mysql includes at... -i</code><code>/usr/include/mysql</code>

<code>checking errmsg.h usability... no</code>

<code>checking errmsg.h presence... no</code>

<code>checking</code><code>for</code> <code>errmsg.h... no</code>

<code>checking mysql.h usability... no</code>

<code>checking mysql.h presence... no</code>

<code>checking</code><code>for</code> <code>mysql.h... no</code>

<code>configure: error: mysql.h is required, please</code><code>install</code> <code>the mysql header package</code>

<code>[root@betty atlas-1.0.3]</code><code>#</code>

失敗原因:找不到 mysql.h 。

解決辦法:在 bootstrap.sh 檔案中添加 cppflags="-i/usr/local/mysql/include/"  。

修改後 bootstrap.sh  檔案如下: 

<code>[root@betty atlas-1.0.3]</code><code># vi bootstrap.sh </code>

<code>pkg_config_path=</code><code>/usr/local/lib/pkgconfig</code> <code>.</code><code>/configure</code> <code>--with-mysql=</code><code>/usr</code> <code>--prefix=</code><code>/usr/local/mysql-proxy</code> <code>cflags=</code><code>"-dhave_lua_h -o2"</code> <code>cppflags=</code><code>"-i/usr/local/mysql/include/"</code> <code>ldflags=</code><code>"-lm -ldl -lcrypto"</code> <code>lua_cflags=</code><code>"-i/usr/local/include/"</code> <code>lua_libs=</code><code>"-l/usr/local/lib -llua"</code>

重新執行 bootstrap.sh 成功(即執行正常操作中的 configure )。

2. 執行 make 

<code>[root@betty atlas-1.0.3]</code><code># make</code>

<code>...</code>

<code>libtool: link:</code><code>gcc</code> <code>-shared  .libs</code><code>/libproxy_la-proxy-plugin</code><code>.o   -wl,-rpath -wl,</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src/</code><code>.libs -wl,-rpath -wl,</code><code>/usr/local/lib</code> <code>-wl,-rpath -wl,</code><code>/usr/local/mysql-proxy/lib</code> <code>-wl,-rpath -wl,</code><code>/usr/local/lib</code> <code>-l</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src/</code><code>.libs -l</code><code>/usr/local/lib</code> <code>-l</code><code>/usr/lib64/mysql</code> <code>-lmysqlclient -lz -lcrypt -l</code><code>/usr/lib64</code> <code>-lssl ../..</code><code>/src/</code><code>.libs</code><code>/libmysql-proxy</code><code>.so</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src/</code><code>.libs</code><code>/libmysql-chassis</code><code>.so ../..</code><code>/src/</code><code>.libs</code><code>/libsql-tokenizer</code><code>.so</code><code>/usr/local/lib/libevent</code><code>.so -lnsl -lresolv -llua</code><code>/usr/local/lib/libgmodule-2</code><code>.0.so</code><code>/usr/local/lib/libgthread-2</code><code>.0.so</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src/</code><code>.libs</code><code>/libmysql-chassis-timing</code><code>.so</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src/</code><code>.libs</code><code>/libmysql-chassis-glibext</code><code>.so -lm -ldl -lcrypto</code><code>/usr/local/lib/libglib-2</code><code>.0.so -lpthread -lrt  -wl,--</code><code>export</code><code>-dynamic -pthread   -pthread -wl,-soname -wl,libproxy.so -o .libs</code><code>/libproxy</code><code>.so</code>

<code>/usr/bin/ld</code><code>: cannot</code><code>find</code> <code>-lmysqlclient</code>

<code>collect2: ld returned 1</code><code>exit</code> <code>status</code>

<code>make</code><code>[3]: *** [libproxy.la] error 1</code>

<code>make</code><code>[3]: leaving directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/plugins/proxy</code><code>'</code>

<code>make</code><code>[2]: *** [all-recursive] error 1</code>

<code>make</code><code>[2]: leaving directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/plugins</code><code>'</code>

<code>make</code><code>[1]: *** [all-recursive] error 1</code>

<code>make</code><code>[1]: leaving directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3'</code>

<code>make</code><code>: *** [all] error 2</code>

失敗原因:找不到 mysqlclient 庫。

解決辦法:在 bootstrap.sh 檔案中修改 ldflags 的内容,添加 "-l/usr/local/mysql/lib/" 。

修改後  bootstrap.sh  檔案如下: 

<code>pkg_config_path=</code><code>/usr/local/lib/pkgconfig</code> <code>.</code><code>/configure</code> <code>--with-mysql=</code><code>/usr</code> <code>--prefix=</code><code>/usr/local/mysql-proxy</code> <code>cflags=</code><code>"-dhave_lua_h -o2"</code> <code>cppflags="-i</code><code>/usr/local/mysql</code>

<code>/include/</code><code>" ldflags="</code><code>-l</code><code>/usr/local/mysql/lib/</code> <code>-lm -ldl -lcrypto</code><code>" lua_cflags="</code><code>-i</code><code>/usr/local/include/</code><code>" lua_libs="</code><code>-l</code><code>/usr/local/lib</code> <code>-llua"</code>

重新 bootstrap.sh &amp;&amp; make 成功。

3. 執行 make install 

<code>[root@betty atlas-1.0.3]</code><code># make install</code>

<code>making</code><code>install</code> <code>in</code> <code>src</code>

<code>make</code><code>[1]: entering directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src</code><code>'</code>

<code>make</code>  <code>install</code><code>-am installdirs installscript</code>

<code>make</code><code>[2]: entering directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3</code><code>/src</code><code>'</code>

<code>/bin/sh</code> <code>..</code><code>/libtool</code>  <code>--tag=cc   --mode=compile</code><code>gcc</code> <code>-dhave_config_h -i. -i..  -i</code><code>/usr/include/mysql</code>  <code>-i</code><code>/usr/local/include/glib-2</code><code>.0 -i</code><code>/usr/local/lib/glib-2</code><code>.0</code><code>/include</code>   <code>-i</code><code>/usr/local/include/</code> <code>-pthread -i</code><code>/usr/local/include/glib-2</code><code>.0 -i</code><code>/usr/local/lib/glib-2</code><code>.0</code><code>/include</code>   <code>-pthread -i</code><code>/usr/local/include/glib-2</code><code>.0 -i</code><code>/usr/local/lib/glib-2</code><code>.0</code><code>/include</code>   <code>-i..</code><code>/lib/</code> <code>-i</code><code>/usr/local/mysql/include/</code>  <code>-dhave_lua_h -o2 -mt libsql_tokenizer_la-sql-tokenizer-keywords.lo -md -mp -mf .deps</code><code>/libsql_tokenizer_la-sql-tokenizer-keywords</code><code>.tpo -c -o libsql_tokenizer_la-sql-tokenizer-keywords.lo `</code><code>test</code> <code>-f</code><code>'../lib/sql-tokenizer-keywords.c'</code> <code>||</code><code>echo</code> <code>'./'</code><code>`..</code><code>/lib/sql-tokenizer-keywords</code><code>.c</code>

<code>test</code> <code>-z</code><code>"/usr/local/mysql-proxy/lib/pkgconfig"</code> <code>||</code><code>/bin/mkdir</code> <code>-p</code><code>"/usr/local/mysql-proxy/lib/pkgconfig"</code>

<code> </code><code>/usr/bin/install</code> <code>-c -m 644 mysql-proxy.pc mysql-chassis.pc</code><code>'/usr/local/mysql-proxy/lib/pkgconfig'</code>

<code>make</code><code>[2]: leaving directory `</code><code>/root/workstation/mnt/atlas-1</code><code>.0.3'</code>

執行成功。

      此時你會發現,可執行程式 mysql-proxy 和 shell 腳本 mysql-proxyd 并沒有安裝到系統的标準可執行檔案所在目錄。可以通過在環境變量 path 中添加的方式進行解決。 

4. 運作可執行程式 mysql-proxy 

      嘗試執行 mysql-proxy 看有什麼輸出(以下給出的 log 資訊中存在本人添加的調試列印,故與原代碼略有差異)。 

<code>[root@betty ~]</code><code># mysql-proxy</code>

<code>2013-11-25 14:41:59: (debug) chassis-stats.c:35: created new global chassis stats at 0x41a3f40</code>

<code>2013-11-25 14:41:59: (debug) chassis-timings.c:124: created new global chassis timer info at 0x41a4dd0</code>

<code>2013-11-25 14:41:59: (debug) mysql-proxy-cli.c:329: [modb] print_version = 0    default_file = (null)</code>

<code>2013-11-25 14:41:59: (debug) mysql-proxy-cli.c:432: [modb] base_dir =</code><code>/usr/local/mysql-proxy</code>

<code>2013-11-25 14:41:59: (critical) chassis-frontend.c:122: failed to get log directory, please</code><code>set</code> <code>by --log-path</code>

<code>2013-11-25 14:41:59: (message) initiating</code><code>shutdown</code><code>, requested from mysql-proxy-cli.c:443</code>

<code>2013-11-25 14:41:59: (message) shutting down normally,</code><code>exit</code> <code>code is: 1</code>

<code>[root@betty ~]</code><code>#</code>

      出現一條 critical 日志,大緻意思是“無法找到儲存日志檔案的路徑位置,需要通過 --log-path 進行指定”。而執行 mysql-proxyd 腳本得到輸出如下:

<code>[root@betty ~]</code><code># mysql-proxyd</code>

<code>usage:</code><code>/usr/local/mysql-proxy/bin/mysql-proxyd</code> <code>instance {start|stop|restart|status}</code>

      綜上,想要運作起來 atlas-1.0.3 ,至少要了解如何設定日志目錄,以及 instance 所代表的含義。檢視 github 上的資訊,發現可以通過自定義配置檔案解決這兩個問題。我的測試配置檔案如下:

<code>[mysql-proxy]</code>

<code>plugins = admin, proxy</code>

<code>admin-username = moooofly</code>

<code>admin-password = moooofly</code>

<code>admin-lua-script =</code><code>/usr/local/mysql-proxy/lib/mysql-proxy/lua/admin</code><code>.lua</code>

<code>proxy-backend-addresses = 127.0.0.1:3306</code>

<code>#proxy-read-only-backend-addresses = 127.0.0.1:3305@1</code>

<code>daemon =</code><code>true</code>

<code>keepalive =</code><code>true</code>

<code>event-threads = 4</code>

<code>log-level = debug</code>

<code>log-path =</code><code>/usr/local/mysql-proxy/log</code>

<code>instance = modb</code>

<code>proxy-address = 0.0.0.0:1234</code>

<code>admin-address = 0.0.0.0:2345</code>

<code>min-idle-connections = 128</code>

<code>#tables = person.mt.id.3</code>

<code>#pwds = user1:+jksgb3yag8=, user2:gs+tr4tpgqc=</code>

<code>charset = utf8</code>

<code>#client-ips = 127.0.0.1, 192.168.1</code>

<code>#lvs-ips = 192.168.1.1</code>

      上述配置中,很多選項目前不需要啟用,是以都注釋掉了。唯一需要說明的是,atlas-1.0.3 對配置檔案的名字有如下限制:要求配置檔案名字和配置檔案中的 instance 的名字要保持一緻。例如我的配置檔案名字為 modb.cnf ,是以 instance 的名字為 modb 。

      重新使用 mysql-proxyd 腳本啟動服務程式,輸出資訊如下: 

<code>[root@betty ~]</code><code># mysql-proxyd modb status</code>

<code>mysql-proxy of modb is not running</code>

<code>[root@betty ~]</code><code># mysql-proxyd modb start</code>

<code>ok: mysql-proxy of modb is started</code>

<code>mysql-proxy of modb is running (7186)</code>

<code>mysql-proxy of modb is running (7187)</code>

<code>[root@betty ~]</code><code># ps aux|grep mysql-proxy</code>

<code>root      7186  0.0  0.0  57960  1028 ?        s    14:54   0:00</code><code>/usr/local/mysql-proxy/bin/mysql-proxy</code> <code>--defaults-</code><code>file</code><code>=</code><code>/usr/local/mysql-proxy/conf/modb</code><code>.cnf</code>

<code>root      7187  0.0  0.0 111524  2356 ?        sl   14:54   0:00</code><code>/usr/local/mysql-proxy/bin/mysql-proxy</code> <code>--defaults-</code><code>file</code><code>=</code><code>/usr/local/mysql-proxy/conf/modb</code><code>.cnf</code>

<code>root      7207  0.0  0.0  61180   752 pts</code><code>/4</code>    <code>s+   14:54   0:00</code><code>grep</code> <code>mysql-proxy</code>

      可以看出,伺服器程式已經正确啟動。此時在 log 目錄下會多出如下檔案:

<code>[root@betty log]</code><code># pwd</code>

<code>/usr/local/mysql-proxy/log</code>

<code>[root@betty log]</code><code>#</code>

<code>[root@betty log]</code><code># ll</code>

<code>總計 8</code>

<code>-rw-r----- 1 root root 1233 11-25 14:54 modb.log</code>

<code>-rw------- 1 root root    4 11-25 14:54 modb.pid</code>

<code>-rw-rw-rw- 1 root root    0 11-25 14:54 sql_modb.log</code>

      其中 modb.log 是伺服器的通用日志;sql_modb.log 是經由 atlas 進行處理、轉發的 sql 日志。

啟動 atlas 時 modb.log 中的日志内容:

<code>[root@betty log]</code><code># tail -f modb.log</code>

<code>2013-11-25 14:54:06: (message) mysql-proxy 0.8.2 started - instance: modb</code>

<code>2013-11-25 14:54:06: (message) max</code><code>open</code> <code>file</code><code>-descriptors = 1024</code>

<code>2013-11-25 14:54:06: (debug) mysql-proxy-cli.c:649: [modb] enter mainloop!!!</code>

<code>2013-11-25 14:54:06: (message) proxy listening on port 0.0.0.0:1234</code>

<code>2013-11-25 14:54:06: (message) added</code><code>read</code><code>/write</code> <code>backend: 127.0.0.1:3306</code>

<code>2013-11-25 14:54:06: (message) proxy-plugin.c:2929: [modb] current charset is</code><code>set</code> <code>to utf8</code>

<code>2013-11-25 14:54:06: (message) proxy-plugin.c:2932: [modb] min_idle_connections is</code><code>set</code> <code>to 32</code>

<code>2013-11-25 14:54:06: (message) chassis-event-thread.c:319: starting 3 worker threads(not include main thread)</code>

<code>2013-11-25 14:54:06: (message) chassis-unix-daemon.c:136: [angel] we try to keep pid=7187 alive</code>

<code>2013-11-25 14:54:06: (debug) chassis-unix-daemon.c:155: waiting</code><code>for</code> <code>7187</code>

      通過 mysql 用戶端經由 atlas 通路 mysql 資料庫時,sql_modb.log 中的日志内容:

【原創】源碼安裝 Atlas-1.0.3 遇到的問題以及解決辦法

<code>[root@betty log]</code><code># tail -f sql_modb.log</code>

<code>[11</code><code>/25/2013</code> <code>14:58:54] c:172.16.80.111 s:127.0.0.1 ok 0.155</code><code>"set names utf8"</code>

<code>[11</code><code>/25/2013</code> <code>14:58:54] c:172.16.80.111 s:127.0.0.1 ok 0.298</code><code>"select @@character_set_database, @@collation_database"</code>

<code>[11</code><code>/25/2013</code> <code>14:58:54] c:172.16.80.111 s:127.0.0.1 ok 0.471</code><code>"show full tables where table_type != 'view'"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 0.124</code><code>"set names utf8"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 19.297</code><code>"show table status like 'test'"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 0.308</code><code>"show create table `test`"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 24.835</code><code>"select table_name, partition_name, subpartition_name, partition_method, subpartition_method, partition_expression, subpartition_expression, partition_description, partition_comment, nodegroup, tablespace_name from information_schema.partitions where table_schema like 'python' and not isnull(partition_name) and table_name like 'test' order by table_name, partition_name, partition_ordinal_position, subpartition_ordinal_position"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 0.279</code><code>"show create table `test`"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 1.221</code><code>"select * from `test` limit 0, 1000"</code>

<code>[11</code><code>/25/2013</code> <code>14:59:01] c:172.16.80.111 s:127.0.0.1 ok 0.707</code><code>"show columns from `python`.`test`"</code>

至此,一個 源碼安裝 的、可用的、 具有基本配置 的 atlas-1.0.3 完成了。

繼續閱讀