By default in mysql database server max_connections is set to 100. This value indicates how many maximum concurrent connections mysql server can handle. If mysql reaches to it maximum (max) limit then you can see errors like "too many connections". I assume that you have enough hardware resources (Mainly RAM )to handle more connections, here with this article I will share a TIP to increase max_connections in mysql.
As we know my.cnf is default configuration file for mysqld service and by default it is located in /etc directory unless and until you have changed it.
To find out how many max_connections are allowed currently on your mysql server use following command from mysql prompt.
mysql> select @@max_connections;
+-------------------+
| @@max_connections |
+-------------------+
| 100 |
+-------------------+
1 row in set (0.00 sec)
max_connections is a GLOBAL variable. we can increase it on the fly without restarting mysqld service.
To do so use following command.
mysql> set global max_connections = 200;
Query OK, 0 rows affected (0.00 sec)
Now, If you check again you will see that limit of max_connections is increased.
mysql> select @@max_connections;
+-------------------+
| @@max_connections |
+-------------------+
| 200 |
+-------------------+
1 row in set (0.00 sec)
Note:
It is important that you edit your /etc/my.cnf to add max_connections = 200 otherwise when you restart mysqld service in future, It will complain again after it hits the old max_connections limit.
Saturday, May 22, 2010
Setup and Running Glassfish as a service on CentOS
1/ Setup Glassfish (GUI Cai dat o che do Graphics)
Download: http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1-unix.sh
Phải đăng nhập vào mode Graphics mới setup Glassfish duoc.
init 5
- Làm theo hướng dẫn step by step
http://docs.sun.com/app/docs/doc/820-7690
2/ Setup Glassfish (Zip)
Huong dan setup
http://docs.sun.com/app/docs/doc/821-1756
- Tao Folder :
mkdir /usr/GF_OSSO_AS
cd /usr/GF_OSSO_AS
wget http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1.zip
unzip glassfish-3.0.1.zip
cd glassfish
chmod 777 chmod 777 /usr/GF_OSSO_AS/glassfishv3/glassfish/bin/asadmin
cd /usr/GF_OSSO_AS/glassfishv3/glassfish/bin
./asadmin start-database --dbhome ../javadb/
Database already started on host 0.0.0.0, port 1527.
Command start-database executed successfully.
[root@webhosting bin]# ./asadmin start-domain
Waiting for DAS to start ...........
Started domain: domain1
Domain location: /usr/GF_OSSO_AS/glassfishv3/glassfish/domains/domain1
Log file: /usr/GF_OSSO_AS/glassfishv3/glassfish/domains/domain1/logs/server.log
Admin port for the domain: 4848
Command start-domain executed successfully.
Test: http://localhost:4848 & http://localhost:8080
3/ Tạo file Script service
cd etc/init.d/
nano glassfish
copy đoạn script o dưới vào
#!/bin/bash
#
# glassfish: Startup script for Glassfish Application Server.
#
# chkconfig: 3 80 05
# description: Startup script for domain1 of Glassfish Application Server.
GLASSFISH_HOME=/root/glassfishv3/glassfish;
export GLASSFISH_HOME
GLASSFISH_OWNER=root;
export GLASSFISH_OWNER
start() {
echo -n "Starting Glassfish: "
echo "Starting Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
sleep 2
echo "done"
}
stop() {
echo -n "Stopping Glassfish: "
echo "Stopping Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
echo "done"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: glassfish {start|stop|restart}"
exit
esac
3/ Install the service
#chmod +x /etc/init.d/glassfish
#chkconfig --add glassfish
#chkconfig --level 3 glassfish on
4/ # Start glassfish.
#/etc/init.d/glassfish start
Download: http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1-unix.sh
Phải đăng nhập vào mode Graphics mới setup Glassfish duoc.
init 5
- Làm theo hướng dẫn step by step
http://docs.sun.com/app/docs/doc/820-7690
2/ Setup Glassfish (Zip)
Huong dan setup
http://docs.sun.com/app/docs/doc/821-1756
- Tao Folder :
mkdir /usr/GF_OSSO_AS
cd /usr/GF_OSSO_AS
wget http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1.zip
unzip glassfish-3.0.1.zip
cd glassfish
chmod 777 chmod 777 /usr/GF_OSSO_AS/glassfishv3/glassfish/bin/asadmin
cd /usr/GF_OSSO_AS/glassfishv3/glassfish/bin
./asadmin start-database --dbhome ../javadb/
Database already started on host 0.0.0.0, port 1527.
Command start-database executed successfully.
[root@webhosting bin]# ./asadmin start-domain
Waiting for DAS to start ...........
Started domain: domain1
Domain location: /usr/GF_OSSO_AS/glassfishv3/glassfish/domains/domain1
Log file: /usr/GF_OSSO_AS/glassfishv3/glassfish/domains/domain1/logs/server.log
Admin port for the domain: 4848
Command start-domain executed successfully.
Test: http://localhost:4848 & http://localhost:8080
3/ Tạo file Script service
cd etc/init.d/
nano glassfish
copy đoạn script o dưới vào
#!/bin/bash
#
# glassfish: Startup script for Glassfish Application Server.
#
# chkconfig: 3 80 05
# description: Startup script for domain1 of Glassfish Application Server.
GLASSFISH_HOME=/root/glassfishv3/glassfish;
export GLASSFISH_HOME
GLASSFISH_OWNER=root;
export GLASSFISH_OWNER
start() {
echo -n "Starting Glassfish: "
echo "Starting Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
sleep 2
echo "done"
}
stop() {
echo -n "Stopping Glassfish: "
echo "Stopping Glassfish at `date`" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1" >> $GLASSFISH_HOME/domains/domain1/logs/startup.log
echo "done"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: glassfish {start|stop|restart}"
exit
esac
3/ Install the service
#chmod +x /etc/init.d/glassfish
#chkconfig --add glassfish
#chkconfig --level 3 glassfish on
4/ # Start glassfish.
#/etc/init.d/glassfish start
Labels:
LINUX-UNIX
Setup and Running Glassfish as a service on CentOS
1/ Setup Glassfish
Phải đăng nhập vào mode Graphics mới setup Glassfish duoc.
init 5
- Làm theo hướng dẫn step by step
http://docs.sun.com/app/docs/doc/820-7690
Phải đăng nhập vào mode Graphics mới setup Glassfish duoc.
init 5
- Làm theo hướng dẫn step by step
http://docs.sun.com/app/docs/doc/820-7690
Labels:
LINUX-UNIX
Subscribe to:
Posts (Atom)