Monthly Archives: December 2016

Number of processes running now: 0

If your MySQL or MariaDB server is rebooting itself using something like ISPConfig:

max_connections=50
innodb_buffer_pool_size = 512M

Other settings is custom:

innodb_file_per_table = 1
innodb_buffer_pool_size = 512M
max_connections=50
max_allowed_packet=256M
table_cache=512
sort_buffer_size=4M
myisam_sort_buffer_size=64M
thread_cache=128
wait_timeout=300
thread_concurrency=1

Error:

161213 11:49:56 mysqld_safe Number of processes running now: 0
161213 11:49:56 mysqld_safe mysqld restarted
161213 11:50:00 [Note] /usr/sbin/mysqld (mysqld 10.0.28-MariaDB) starting as process 1233 …
161213 11:50:00 [Note] InnoDB: Using mutexes to ref count buffer pool pages

can’t start server: Bind on TCP/IP port. Got error: 98: Address already in use


ps aux | grep mysql

root 553 0.0 0.0 11448 1540 ? S 13:54 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/cloudlix.com.pid
mysql 657 0.0 4.1 1177708 105960 ? Sl 13:54 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/cloudlix.com.err --pid-file=/var/lib/mysql/cloudlix.com.pid

service mysql stop if not working:

kill -9 553 && kill -9 657

create glassfish jdbc resource

#!/bin/bash
# Shell script to create the GlassFish 4 JDBC Connection pool for Mysql

# http://stackoverflow.com/questions/6572895/how-can-i-create-a-mysql-connection-pool-using-asadmin-tool-in-glassfish-server
echo "Create JDBC connection pool"
asadmin create-jdbc-connection-pool \
--datasourceclassname \
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource \
--restype javax.sql.DataSource \
--property User=arquillian:Password=arquillian:URL=\"jdbc:mysql://localhost:3306/arquillian\" \
ArquillianPool

# An alternative command line
# asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource
# --property user=root:password=test:DatabaseName=test:ServerName=localhost:port=3306 test-pool

echo "Create JDBC resource"
asadmin create-jdbc-resource --connectionpoolid ArquillianPool jdbc/arquillian

OpenResty

OpenResty ™ is a full-fledged web platform by integrating the standard Nginx core, LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules, and most of their external dependencies. It is designed to help developers easily build scalable web applications, web services, and dynamic web gateways.

By taking advantage of various well-designed Nginx modules (most of which are developed by the OpenResty team themselves), OpenResty effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K ~ 1000K+ connections in a single box.

OpenResty aims to run your server-side web app completely in the Nginx server, leveraging Nginx’s event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis.

iptables limit connection rate

iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP

iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m limit --limit 50/minute --limit-burst 200 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 50/second --limit-burst 50 -j ACCEPT
iptables -A INPUT -j REJECT