近日求职,顺便回顾了一下过去12年的工作经历。
似乎再一次看清了我的致命缺点:
懒于总结,从而导致了对待事情缺少原则,回顾时也无迹可寻,更是没有自省过程。
每次面对新的局面,新的问题时,我都重头思考,依靠着大量支离破碎的经验记忆做出一些判断。以至于同样的错误可能会犯上好几次。
简直智障~
近日求职,顺便回顾了一下过去12年的工作经历。
似乎再一次看清了我的致命缺点:
懒于总结,从而导致了对待事情缺少原则,回顾时也无迹可寻,更是没有自省过程。
每次面对新的局面,新的问题时,我都重头思考,依靠着大量支离破碎的经验记忆做出一些判断。以至于同样的错误可能会犯上好几次。
简直智障~
随着www.indier.com的开启,2016,VG / IG两兄弟站并行~
今天遇到的问题是,开启了一个node进程,但不小心退出了shell,之后再进入服务器就看不到这个node进程了。
再次开启这个node服务就报错,那么我们如何关闭之前的node进程呢?
首先,我们要查看当前有多少关于”node”的进程:
1 |
ps -ef | grep node |
得到结果:
1 2 3 4 |
root 2749 13723 0 08:38 ? 00:00:00 /usr/local/bin/node /root/xxxxx.js root 10638 9484 0 14:59 pts/0 00:00:01 node xxxyyy.js root 11847 11487 0 15:52 pts/1 00:00:00 grep node root 13723 1 0 Nov12 ? 00:00:00 /usr/local/bin/node /usr/local/lib/node_modules/forever/bin/monitor xxxxx.js |
OK,我看到了自己之前开启的xxxyyy.js,他的进程ID是10638!
杀了它:
1 |
kill -2 10638 |
搞定!-9是强杀,-2是什么各位只有自己去查一下kill的指令说明了。
今天使用npm安装一个nodejs服务,丢出一系列报错:
1 |
npm WARN locking Error: EACCES, open '/Users/xxxxxxxxxxx.lock' |
解决方法很简单:
1 |
npm cache clean |
1 2 3 4 5 6 7 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 |
# The following options will be passed to all MySQL clients [client] character-set-server = utf8 #####客户端默认连接字集集,若编译安装时已指定则不用填写 port = 3306 ###客户端连接通信端口 socket = /tmp/mysql.sock #客户端通信的用户密码端口等信息保存文件 # Here follows entries for some specific programs # The MySQL server [mysqld] port = 3306 #mysql服务端监听端口 basedir = /usr/local/mysql ###Mysql软件目录 datadir = /usr/local/mysql/var ###mysql数据库存放目录 socket = /tmp/mysql.sock ##服务端通信文件,若丢失则重启Mysql重新生成,若重启失败,则可能由于mysqld进程未杀死,用pkill mysql后则能重启成功Mysql pid-file =/usr/local/mysql/var/mysql.pid ##服务端pid进程文件,若丢失则重启Mysql重新生成,若重启失败,则可能由于mysqld进程未杀死,用pkill mysql后则能重启成功Mysql skip-external-locking ###防止外部锁定表 skip-name-resolve ###禁止Mysqlr的DNS解析,只能通过IP连接数据库 key_buffer_size = 384M ###仅针对Myisam表引擎缓存优化 max_allowed_packet = 32M ###客户端最大查询表使用的内存 table_open_cache = 1024 ###服务器最大缓存表数量 sort_buffer_size = 2M ##每个连接的最大排序内存 join_buffer_size = 1M ##每个连接使用join查询语句的最大内存 net_buffer_length = 1M read_buffer_size = 2M read_rnd_buffer_size = 16M myisam_sort_buffer_size = 128M thread_cache_size = 300 query_cache_size = 256M query_cache_limit = 2M thread_concurrency = 4 ##CPU*2 wait_timeout = 120 ###SQL语句最大执行时间 max_connections = 5000 ###允许数据库最大连接数 max_connect_errors = 6000 ##允许客户端连接数据库出错次数,能防止暴力破解数据库密码 character-set-server = utf8 ##服务器和数据库默认字符集 collation-server = utf8_general_ci ###客户端校正字符集 log_slow_queries = slowquery.log ##慢查询日志文件 long_query_time = 3 ###慢查询时间 myisam_recover ###mysql重启自动修复MYisam表 replicate-ignore-db = mysql ###数据同步时不需要同步的数据库名称 replicate-ignore-db = information_schema bind-address = 121.14.145.96 ##服务器多个IP时写上比较重要 # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (via the "enable-named-pipe" option) will render mysqld useless! # #skip-networking # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # binary logging format - mixed recommended binlog_format=mixed # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1 # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /usr/local/mysql/var #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /usr/local/mysql/var # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 32M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout |
在服务器上无法删除图片,在本地测试却可以,那么可以尝试将delete_type改为POST,不是所有服务器都支持DELETE。
1 |
'delete_type' => 'POST', |
试过几个方案,fopen/fwrite、file_get_contents/file_put_contents,最后还是采用了curl,效率高,图片也不会坏掉,只是听说对服务器消耗要大一些,也有高手建议使用socket。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
//curl抓取图片过程 function curl_img($img_url,$path){ $ch = curl_init(); if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); } curl_setopt($ch, CURLOPT_URL, $img_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $img = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); if ($info['http_code'] != 200) $img = NULL; if($img)//保存图片到本地 @file_put_contents ($path, $img); } |