在supervisor默认配置中,其启动的sock等都会放到tmp目录,而tmp目录会自动清理导致无法使用supervisorctl命令,此时:
修改supervisor.conf文件,修改到/var/run/及/var/log/目录,具体配置就不进行贴了,简单直接搜索tmp进行修改即可。
重启supervisor服务,记得kill原来服务。
来自:http://blog.csdn.net/binggoogle/article/details/70820966
在supervisor默认配置中,其启动的sock等都会放到tmp目录,而tmp目录会自动清理导致无法使用supervisorctl命令,此时:
修改supervisor.conf文件,修改到/var/run/及/var/log/目录,具体配置就不进行贴了,简单直接搜索tmp进行修改即可。
重启supervisor服务,记得kill原来服务。
来自:http://blog.csdn.net/binggoogle/article/details/70820966
比如我们有个文件 /www/py.py
cd /www
然后我们启动可以用nohup
nohup python py.py >/dev/null 2>&1 &
启动成功与否我们可以查看一下进程
ps aux | grep ‘py.py’
centos安装 python-dev包提示No package python-dev available:
出现此问题的原因是python-dev的包在centos的yum中不叫python-dev,而是python-devel.
所以使用下面的命令即可安装python-dev:
yum install python-devel
系统有个php5.5.14 现在需要再安装个php5.6.31
1.php.net 下载php5.6.31并安装
tar zxvf php-5.6.31.tar.gz
cd php-5.6.31
./configure –prefix=/usr/local/php56 –with-config-file-path=/usr/local/php56/etc –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-iconv-dir –with-freetype-dir=/usr/local/freetype –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –enable-mbregex –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –with-gettext –disable-fileinfo –enable-opcache –enable-intl –with-xsl
遇到一些错误 参考http://www.bkjia.com/PHPjc/1008013.html
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
安装 libicu-devel
yum -y install libicu-devel
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
安装 libxslt-devel
yum -y install libxslt-devel
注意一下make
make ZEND_EXTRA_LIBS=’-liconv’
make install
2
拷贝配置文件
cp -R ./sapi/fpm/php-fpm.conf /usr/local/php56/etc/php-fpm.conf
cp php.ini-development /usr/local/php56/etc/php.ini
cp /etc/init.d/php-fpm /etc/init.d/php-fpm56
php-fpm56修改一下PHP的目录就可以了
4.配置php-fpm 修改php-fpm.conf的侦听端口为9001,因为主版本5.5.14是侦听9000。 killall php-fpm56
/usr/local/php56/etc/php-fpm.conf
listen = 127.0.0.1:9001
配置PHP.ini
# php extensions
echo “Modify php.ini……”
sed -i ‘s/post_max_size =.*/post_max_size = 50M/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/upload_max_filesize =.*/upload_max_filesize = 50M/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/;date.timezone =.*/date.timezone = PRC/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/short_open_tag =.*/short_open_tag = On/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/max_execution_time =.*/max_execution_time = 300/g’ /usr/local/php56/etc/php.ini
sed -i ‘s/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g’ /usr/local/php56/etc/php.ini
echo “Creating new php-fpm configure file…”
cat >/usr/local/php56/etc/php-fpm.conf<<EOF
[global]
pid = /usr/local/php56/var/run/php-fpm.pid
error_log = /usr/local/php56/var/log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php56-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/php56slow.log
EOF
fastcgi_pass 127.0.0.1:9001;
下面备注一下需要装一些库
extension=yaf.so
extension=memcache.so
extension=memcached.so
extension=redis.so
extension=bz2.so
下面是个文件,请下载查看
MySQL报错 Lock wait timeout exceeded; try restarting transaction
1,查看数据库的隔离级别:
mysql> select @@tx_isolation;
+—————–+
| @@tx_isolation |
+—————–+
| READ-COMMITTED |
+—————–+
1 row in set (0.00 sec)
2,去查看先当前库的线程情况:
mysql> show full processlist;
没有看到正在执行的慢SQL记录线程,再去查看innodb的事务表INNODB_TRX,看下里面是否有正在锁定的事务线程,看看ID是否在show full processlist里面的sleep线程中,如果是,就证明这个sleep的线程事务一直没有commit或者rollback而是卡住了,我们需要手动kill掉。
mysql> SELECT * FROM information_schema.INNODB_TRX;
3,看到有两条记录,然后找到 trx_mysql_thread_id
mysql> SELECT trx_mysql_thread_id FROM information_schema.INNODB_TRX;
mysql> kill 7226287;
Query OK, 0 rows affected (0.00 sec)
mysql> kill 5201247;
Query OK, 0 rows affected (0.00 sec)
然后再去查询INNODB_TRX表,就没有阻塞的事务sleep线程存在了,如下所示:
mysql> SELECT * FROM information_schema.INNODB_TRX;
再去执行update语句,就能正常执行了,如下所示:
4,总结分析
表数据量也不大,按照普通的情况来说,简单的update应该不会造成阻塞的,mysql都是autocommit,不会出现update卡住的情况,去查看下autocommit的值。
mysql> select @@autocommit;
+————–+
| @@autocommit |
+————–+
| 1 |
+————–+
1 row in set (0.00 sec)
如果是0的话 就设置为1 set global autocommit=1;