Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build mysql and q4m

  • Loading branch information...
commit 31e99d277fe736b247128df51e4aee8252193582 0 parents
@kazeburo authored
Showing with 227 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +27 −0 q4m/my.cnf
  3. +118 −0 q4m/q4m.init
  4. +81 −0 q4m/setup.sh
1  .gitignore
@@ -0,0 +1 @@
+*~
27 q4m/my.cnf
@@ -0,0 +1,27 @@
+[mysql]
+port = 13306
+socket = /tmp/mysql_q4m.sock
+
+[mysqld]
+basedir = /usr/local/q4m
+datadir = /usr/local/q4m/var
+user = nobody
+port = 13306
+socket = /tmp/mysql_q4m.sock
+skip-external-locking
+key_buffer = 1M
+max_allowed_packet = 64M
+table_cache = 256
+max_connections = 4096
+max_connect_errors = 10000
+sort_buffer_size = 128K
+read_buffer_size = 128K
+myisam_sort_buffer_size = 128K
+thread_cache = 256
+query_cache_size = 0M
+thread_concurrency = 8
+tmp_table_size = 64M
+skip_name_resolve
+slow_query_log
+long_query_time = 10
+
118 q4m/q4m.init
@@ -0,0 +1,118 @@
+#!/bin/bash
+#
+# q4m MySQL-Q4M
+#
+# chkconfig: - 64 36
+# description: MySQL-Q4M
+# processname: mysqld
+# config: /usr/local/q4m/etc/my.cnf
+# pidfile: /usr/local/q4m/var/$(hostname).pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+prog=MySQL-Q4M
+datadir=/usr/local/q4m/var
+installdb=/usr/local/q4m/bin/mysql_install_db
+mysqld_safe=/usr/local/q4m/bin/mysqld_safe
+mypidfile=/usr/local/q4m/var/$(hostname).pid
+
+start(){
+ if [ ! -d "$datadir" ] ; then
+ action $"Initializing MySQL database: " $installdb --defaults-file=/usr/local/q4m/etc/my.cnf
+ ret=$?
+ if [ $ret -ne 0 ] ; then
+ return $ret
+ fi
+ fi
+ chmod 0755 "$datadir"
+ $mysqld_safe --defaults-file=/usr/local/q4m/etc/my.cnf >/dev/null 2>&1 &
+ ret=$?
+
+ if [ $ret -eq 0 ]; then
+ STARTTIMEOUT=3
+ while [ $STARTTIMEOUT -gt 0 ]; do
+ RESPONSE=`/usr/local/q4m/bin/mysqladmin --defaults-file=/usr/local/q4m/etc/my.cnf -uUNKNOWN_MYSQL_USER ping 2>&1` && break
+ echo "$RESPONSE" | grep -q "Access denied for user" && break
+ sleep 1
+ let STARTTIMEOUT=${STARTTIMEOUT}-1
+ done
+ if [ $STARTTIMEOUT -eq 0 ]; then
+ echo "Timeout error occurred trying to start MySQL Daemon."
+ action $"Starting $prog: " /bin/false
+ else
+ action $"Starting $prog: " /bin/true
+ fi
+ else
+ action $"Starting $prog: " /bin/false
+ fi
+ [ $ret -eq 0 ] && touch /var/lock/subsys/q4m
+ return $ret
+}
+
+stop(){
+ MYSQLPID=`cat "$mypidfile" 2>/dev/null `
+ if [ -n "$MYSQLPID" ]; then
+ /bin/kill "$MYSQLPID" >/dev/null 2>&1
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ STOPTIMEOUT=60
+ while [ $STOPTIMEOUT -gt 0 ]; do
+ /bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
+ sleep 1
+ let STOPTIMEOUT=${STOPTIMEOUT}-1
+ done
+ if [ $STOPTIMEOUT -eq 0 ]; then
+ echo "Timeout error occurred trying to stop MySQL Daemon."
+ ret=1
+ action $"Stopping $prog: " /bin/false
+ else
+ rm -f /var/lock/subsys/q4m
+ rm -f "$socketfile"
+ action $"Stopping $prog: " /bin/true
+ fi
+ else
+ action $"Stopping $prog: " /bin/false
+ fi
+ else
+ ret=1
+ action $"Stopping $prog: " /bin/false
+ fi
+ return $ret
+}
+
+restart(){
+ stop
+ start
+}
+
+condrestart(){
+ [ -e /var/lock/subsys/q4m ] && restart || :
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status mysqld
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart)
+ condrestart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|condrestart|restart}"
+ exit 1
+esac
+
+exit $?
81 q4m/setup.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+set -e
+
+MYVER=5.1.60
+Q4MVER=0.9.5
+
+CDIR=$(cd $(dirname $0) && pwd)
+cd /usr/local/src
+
+if [ ! -f mysql-$MYVER.tar.gz ]; then
+ wget http://downloads.mysql.com/archives/mysql-5.1/mysql-$MYVER.tar.gz
+fi
+
+if [ -d mysql-$MYVER ]; then
+ rm -rf mysql-$MYVER
+fi
+tar zxf mysql-$MYVER.tar.gz
+cd mysql-$MYVER
+./configure \
+ --prefix=/usr/local/q4m \
+ --with-mysqld-ldflags="-static" \
+ --with-client-ldflags="-static" \
+ --enable-assembler \
+ --enable-thread-safe-client \
+ --with-charset=utf8 \
+ --with-zlib-dir=bundled \
+ --with-big-tables \
+ --with-mysqld-user=nobody \
+ --with-pic \
+ --with-extra-charsets=all \
+ --with-readline \
+ --without-debug \
+ --enable-shared \
+ --with-fast-mutexes \
+ --with-comment="Q4M" \
+ --with-server-suffix="-q4m" \
+ --with-unix-socket-path="/tmp/mysql_q4m.sock" \
+ --with-tcp-port=13306 \
+ --with-plugins=none \
+ --without-plugin-daemon_example \
+ --without-plugin-ftexample \
+ --without-plugin-archive \
+ --without-plugin-blackhole \
+ --without-plugin-example \
+ --without-plugin-federated \
+ --without-plugin-innobase \
+ --without-plugin-innodb_plugin \
+ --without-docs \
+ --without-man
+make
+make install
+
+mkdir -p /usr/local/q4m/etc
+cp $CDIR/my.cnf /usr/local/q4m/etc
+cp $CDIR/q4m.init /etc/init.d/q4m
+chmod 755 /etc/init.d/q4m
+chkconfig --add q4m
+
+/usr/local/q4m/bin/mysql_install_db --defaults-file=/usr/local/q4m/etc/my.cnf
+chmod 755 /usr/local/q4m/var
+/etc/init.d/q4m start
+
+cd /usr/local/src
+if [ ! -f q4m-$Q4MVER.tar.gz ]; then
+ wget http://q4m.kazuhooku.com/dist/q4m-$Q4MVER.tar.gz
+fi
+if [ -d q4m-$Q4MVER ]; then
+ rm -rf q4m-$Q4MVER
+fi
+tar zxf q4m-$Q4MVER.tar.gz
+cd q4m-$Q4MVER
+CPPFLAGS="-I/usr/local/q4m/include/mysql" CFLAGS="-L/usr/local/q4m/lib/mysql" ./configure \
+ --with-mysql=/usr/local/src/mysql-$MYVER \
+ --prefix=/usr/local/q4m
+make
+mkdir -p /usr/local/q4m/lib/mysql/plugin
+cp src/.libs/libqueue_engine.so /usr/local/q4m/lib/mysql/plugin/
+cat support-files/install.sql | /usr/local/q4m/bin/mysql -S /tmp/mysql_q4m.sock
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.