{"id":1276,"date":"2013-12-28T17:21:53","date_gmt":"2013-12-28T09:21:53","guid":{"rendered":"http:\/\/www.esojourn.org\/?p=1276"},"modified":"2013-12-28T17:48:43","modified_gmt":"2013-12-28T09:48:43","slug":"centos-6-web%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%bf%81%e7%a7%bb","status":"publish","type":"post","link":"https:\/\/ybzx.vip\/wp\/?p=1276","title":{"rendered":"CentOS 6 Web\u670d\u52a1\u5668\u8fc1\u79fb"},"content":{"rendered":"<div>\u4e00\u53f0\u8001\u670d\u52a1\u5668\u7528\u4e865\u5e74\u4e86\u3002\u4e3a\u4e86\u4fdd\u8bc1\u7a33\u5b9a\u6027\uff0c\u5728\u5b83\u51fa\u6bdb\u75c5\u4e4b\u524d\uff0c\u9884\u5148\u6362\u53f0\u65b0\u670d\u52a1\u5668\u3002<\/div>\n<div>\u672c\u6587\u8bb0\u5f55\u4e86\u670d\u52a1\u5668\u8fc1\u79fb\u7684\u5168\u90e8\u8fc7\u7a0b\u3002<\/div>\n<div><\/div>\n<div>\u672c\u6587\u6863\u53c2\u8003\u4e86\u672c\u6587\u7684\u5927\u7eb2\uff1a<\/div>\n<div><a href=\"http:\/\/docs.webfaction.com\/user-guide\/moving.html#simple-migration\">http:\/\/docs.webfaction.com\/user-guide\/moving.html#simple-migration<\/a><\/div>\n<div>\u540c\u65f6\u5728\u5b9e\u8df5\u5de5\u4f5c\u4e2d\uff0c\u52a0\u5165\u4e86\u81ea\u5df1\u7684\u65b9\u6cd5\u548c\u7ecf\u9a8c\u3002<\/div>\n<div><\/div>\n<div>\u5168\u90e8\u5185\u5bb9\u5206\u4e3a\u4ee5\u4e0b\u51e0\u90e8\u5206<\/div>\n<div>\n<ol>\n<li>\u5efa\u7acb\u7528\u6237<\/li>\n<li>\u590d\u5236\u7f51\u7ad9\u76ee\u5f55<\/li>\n<li>\u4fee\u6539\u672c\u5730hosts\u6587\u4ef6\uff0c\u51c6\u5907\u6d4b\u8bd5<\/li>\n<li>\u5b89\u88c5\u6240\u6709\u5fc5\u8981\u7a0b\u5e8f<\/li>\n<li>\u590d\u5236\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>MySQL\u6570\u636e\u8fc1\u79fb<\/li>\n<li>MYSQL\u6570\u636e\u8fc1\u79fb\u540e\uff0c\u539f\u4e3b\u673a\u4e0a\u6570\u636e\u6709\u66f4\u65b0\u600e\u4e48\u529e\uff1f<\/li>\n<li>MYSQL\u6570\u636e\u8fc1\u79fb\u540e\uff0c\u5982\u4f55\u9a8c\u8bc1\u6570\u636e\u76f8\u7b26\uff1f<\/li>\n<li>\n<div>\u62f7\u8d1d\u5e38\u7528\u7ba1\u7406\u811a\u672c<\/div>\n<\/li>\n<li>\n<div><span style=\"line-height: 1.5em;\">\u62f7\u8d1dcrontab<\/span><\/div>\n<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<\/div>\n<div><b>\u5efa\u7acb\u7528\u6237<\/b><\/div>\n<div><\/div>\n<div>\u5bf9\u7167\u8001\u673a\u5668\u4e0a vi \/etc\/passwd<\/div>\n<div>\u5728\u65b0\u673a\u5668\u4e0a\u9010\u4e2a useradd<\/div>\n<div><\/div>\n<div><\/div>\n<div><b>\u590d\u5236\u7f51\u7ad9\u76ee\u5f55<\/b><\/div>\n<div>\u6587\u4ef6\u5f88\u591a\uff0c\u7528rsync\u5427\u3002\u7b97\u6cd5\u6bd4scp\u667a\u80fd\u3002<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">rsync -PaAz -e 'ssh -p PORTNUMBER' \/var\/www\/html\/ root@11.22.33.44:\/var\/www\/html\/<\/pre>\n<\/div>\n<div>\u5982\u679c\u591a\u6b21\u590d\u5236\uff0c\u9700\u8981\u5220\u9664\u4e0d\u7528\u6587\u4ef6\uff0c\u52a0\u4e0a &#8211;delete\u3002<\/div>\n<div><\/div>\n<div><\/div>\n<div><b>\u4fee\u6539\u672c\u5730HOSTS\u6587\u4ef6\uff0c\u51c6\u5907\u6d4b\u8bd5<\/b><\/div>\n<div>\u5bf9\u7167\/etc\/httpd\/conf\/httpd.conf\u4e2d\uff0c\u6bcf\u4e2a\u865a\u62df\u4e3b\u673a\u57df\u540d\uff0c\u5728\u672c\u673ahosts\u6587\u4ef6\u4e2d\uff0c\u6307\u5411\u65b0\u4e3b\u673a\u7684IP\u5730\u5740\u3002<\/div>\n<div>\u4ee5\u4fbf\u540e\u9762\u8fde\u5230\u65b0\u4e3b\u673a\u4e0a\u9010\u4e2a\u6d4b\u8bd5\u6bcf\u4e2a\u7f51\u7ad9\u3002<\/div>\n<div><b>\u00a0<\/b><\/div>\n<div><b>\u5b89\u88c5\u6240\u6709\u5fc5\u8981\u7a0b\u5e8f<\/b><\/div>\n<div><b>\u00a0<\/b><\/div>\n<div>\n<div>\u5b89\u88c5apache, php, mysql, vsftpd\u7b49\u3002\u8be6\u7ec6\u8bb0\u5f55\u89c1\uff1a<a href=\"http:\/\/dingxuan.info\/wp\/?p=327\">http:\/\/dingxuan.info\/wp\/?p=327<\/a><\/div>\n<div>\u6709\u51e0\u4e2a\u7a0b\u5e8f\u8981\u6ce8\u610f\u66f4\u65b0SELINUX\u8bbe\u7f6e\uff0c\u4f8b\u5982\uff1asetsebool -P allow_ftpd_full_access 1<\/div>\n<\/div>\n<div><\/div>\n<div><b>\u590d\u5236\u914d\u7f6e\u6587\u4ef6<\/b><\/div>\n<div>\u4ee5apache\u914d\u7f6e\u6587\u4ef6\u4e3a\u4f8b\uff1a<\/div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">scp -r -P 12345 \/etc\/httpd\/conf root@11.22.33.44:\/etc\/httpd\/<\/pre>\n<div>\u590d\u5236\u8fc7\u53bb\u4e4b\u540e\uff0c\u8bb0\u5f97\u628a\u5c1a\u672a\u5b89\u88c5\u7684\u6a21\u5757\uff0c\u5148\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u6ce8\u91ca\u6389\u3002<\/div>\n<div><\/div>\n<div><b>MYSQL\u6570\u636e\u8fc1\u79fb<\/b><\/div>\n<div><b>\u00a0<\/b><\/div>\n<div>\u8fc1\u79fb\u65b9\u6cd5\u6709\u5f88\u591a\u79cd\u9009\u62e9<\/div>\n<div>\n<ol>\n<li>\u4fdd\u8bc1\u4e24\u53f0\u673a\u5668mysql\u7248\u672c\u4e00\u6837\u3002<span style=\"text-decoration: underline;\">\u505c\u670d\u52a1\u540e<\/span>\u76f4\u63a5copy\u6570\u636e\u6587\u4ef6\u3002<br \/>\n\u901f\u5ea6\u5feb\uff0c\u4f46\u611f\u89c9\u6709\u98ce\u9669\u3002<\/li>\n<li>mysqldump\uff1a<\/li>\n<li>MySQL Workbench<br \/>\nworkbench\u6709migration\u5de5\u5177\uff0c\u4f46\u6211\u76842G\u6570\u636e\u6570\u5bfc\u5165\u5bfc\u51fa\u5f88\u6162\u3002\u6700\u540e\u8fd8\u62a5\u51fa\u4e00\u5806\u9519\u8bef\u3002<\/li>\n<li>\u8bd5\u9a8c\u591a\u6b21\uff0c\u53d1\u73b0innobackupex\u00a0\u662f\u6700\u597d\u7528\u7684\u3002<\/li>\n<\/ol>\n<div>\u53c2\u89c1\uff1a<a href=\"http:\/\/freeloda.blog.51cto.com\/2033581\/1254883\">http:\/\/freeloda.blog.51cto.com\/2033581\/1254883<\/a><\/div>\n<div><\/div>\n<div>\u547d\u4ee4\u683c\u5f0f\uff1a<\/div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">innobackupex --host=localhost --user=root --password=passwd \/root\/mysqlbackup\/\r\ninnobackupex --host=localhost --user=root --password=123456\u00a0 --defaults-file=\/etc\/my.cnf \/root\/mybackup\/xtrabackup\/<\/pre>\n<div><\/div>\n<div>\u793a\u4f8b\uff1a<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;root@mysql data]# service mysqld stop\r\n&#x5B;root@mysql data]# rm -rf \/mydata\/data\/*\r\n&#x5B;root@mysql data]# innobackupex --apply-log \/root\/mybackup\/xtrabackup\/2013-07-23_05-48-03\/\r\n#--apply-log \u7684\u610f\u4e49\u5728\u4e8e\u628a\u5907\u4efd\u65f6\u6ca1commit\u7684\u4e8b\u52a1\u64a4\u9500\uff0c\u5df2\u7ecfcommit\u7684\u4f46\u8fd8\u5728\u4e8b\u52a1\u65e5\u5fd7\u4e2d\u7684\u5e94\u7528\u5230\u6570\u636e\u5e93\r\n&#x5B;root@mysql data]# innobackupex --copy-back \/root\/mybackup\/xtrabackup\/2013-07-23_05-48-03\/\r\n#--copy-back\u6570\u636e\u5e93\u6062\u590d\uff0c\u540e\u9762\u8ddf\u4e0a\u5907\u4efd\u76ee\u5f55\u7684\u4f4d\u7f6e\r\n&#x5B;root@mysql data]# chown -R mysql:mysql \/mydata\/data\r\n&#x5B;root@mysql data]# service mysqld start #\u5982\u679c\u80fd\u542f\u52a8\u4ee3\u8868\u6062\u590d\u6b63\u5e38\r\n&#x5B;root@A1-2013 lib]# service mysqld start\r\n MySQL Daemon failed to start.\r\n Starting mysqld:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#x5B;FAILED]<\/pre>\n<div><\/div>\n<div>\u6570\u636e\u5e93\u6ca1\u542f\u6765\uff0c\u67e5\u65e5\u5fd7\uff1a<\/div>\n<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;root@A1-2013 lib]#\u00a0vi \/var\/log\/mysqld.log\r\n131228 11:18:55 mysqld_safe Starting mysqld daemon with databases from \/var\/lib\/mysql\r\n ^G\/usr\/libexec\/mysqld: Can't find file: '.\/mysql\/plugin.frm' (errno: 13)\r\n 131228 11:18:55 &#x5B;ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.\r\n 131228 11:18:55\u00a0 InnoDB: Initializing buffer pool, size = 8.0M\r\n 131228 11:18:55\u00a0 InnoDB: Completed initialization of buffer pool\r\n 131228 11:18:55\u00a0 InnoDB: Operating system error number 13 in a file operation.\r\n InnoDB: The error means mysqld does not have the access rights to\r\n InnoDB: the directory.\r\n InnoDB: File name .\/ibdata1\r\n InnoDB: File operation call: 'open'.\r\n InnoDB: Cannot continue operation.\r\n 131228 11:18:55 mysqld_safe mysqld from pid file \/var\/run\/mysqld\/mysqld.pid ended<\/pre>\n<\/div>\n<div>SELINUX\u7684\u95ee\u9898\uff1a<\/div>\n<div><\/div>\n<div>\u5728\u539f\u6765\u4e3b\u673a\u4e0a\u67e5\u770b\uff1a<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;root@mysql data]#\u00a0ll -Z \/var\/lib\/mysql\r\n\r\n -rw-r-----\u00a0 mysql mysql system_u:object_r:mysqld_db_t\u00a0\u00a0\u00a0 ibdata1\r\n -rw-r-----\u00a0 mysql mysql system_u:object_r:mysqld_db_t\u00a0\u00a0\u00a0 ib_logfile0\r\n -rw-r-----\u00a0 mysql mysql system_u:object_r:mysqld_db_t\u00a0\u00a0\u00a0 ib_logfile1<\/pre>\n<\/div>\n<div>\u5728\u65b0\u4e3b\u673a\u4e0a\u67e5\u770b\uff1a<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&#x5B;root@mysql data]#\u00a0ll -Z \/var\/lib\/mysql&lt;\/div&gt;\r\n&lt;div&gt;-rw-rw----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ibdata1\r\n -rw-rw----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ib_logfile0\r\n -rw-rw----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ib_logfile1\r\n\r\n chcon -v --type=mysqld_db_t \/var\/lib\/mysql\r\n chcon -v --type=mysqld_db_t \/var\/lib\/mysql\/*\r\n chcon -v --type=mysqld_db_t \/var\/lib\/mysql\/mysql\r\n chcon -v --type=mysqld_db_t \/var\/lib\/mysql\/mysql\/*\r\n And so forth for any directories that you have under \/var\/lib\/mysql\r\n<\/pre>\n<\/div>\n<div><a href=\"http:\/\/itmanager.blogs.com\/notes\/2012\/06\/restoring-a-mysql-database-from-files.html\">http:\/\/itmanager.blogs.com\/notes\/2012\/06\/restoring-a-mysql-database-from-files.html<\/a><\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n &#x5B;root@mysql data]#\u00a0chcon -R -u system_u -r object_r -t mysqld_db_t \/var\/lib\/mysql\/\r\n &#x5B;root@mysql data]#semanage fcontext -a -t mysqld_db_t &quot;\/var\/lib\/mysql(\/.*)?&quot;\r\n &#x5B;root@mysql data]#restorecon -Rv \/var\/lib\/mysql<\/pre>\n<\/div>\n<div><a href=\"https:\/\/blogs.oracle.com\/jsmyth\/entry\/selinux_and_mysql\">https:\/\/blogs.oracle.com\/jsmyth\/entry\/selinux_and_mysql<\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div><b>MYSQL\u6570\u636e\u8fc1\u79fb\u540e\uff0c\u539f\u4e3b\u673a\u4e0a\u6570\u636e\u6709\u66f4\u65b0\u600e\u4e48\u529e\uff1f<\/b><\/div>\n<div><b>\u00a0<\/b><\/div>\n<div>\u8bbe\u7f6e\u4e3b\u4ece\u81ea\u52a8\u590d\u5236Replication\u3002\u6700\u7b80\u5355\u7684\u529e\u6cd5\uff0c\u8ddf\u7740phpMyAdmin\u91cc\u7684\u590d\u5236\u8bf4\u660e\u914d\u7f6e\u3002<\/div>\n<div>\u66f4\u8be6\u7ec6\u7684\u8bf4\u660e\uff1a<\/div>\n<div><a href=\"http:\/\/freeloda.blog.51cto.com\/2033581\/1282329\">http:\/\/freeloda.blog.51cto.com\/2033581\/1282329<\/a><\/div>\n<div><\/div>\n<div><b>MYSQL\u6570\u636e\u8fc1\u79fb\u540e\uff0c\u5982\u679c\u9a8c\u8bc1<\/b><b>\u6570\u636e\u76f8\u7b26\uff1f<\/b><\/div>\n<div><b>\u00a0<\/b><\/div>\n<div>\u6709mysqldiff\u7b49\u51e0\u79cd\u5de5\u5177\uff0c\u6700\u540e\u9009\u62e9workbench utilities\u4e2d\u7684mysqldbcompare<\/div>\n<div><\/div>\n<div><a href=\"http:\/\/scriptingmysql.wordpress.com\/2013\/01\/31\/using-mysql-utilities-workbench-script-mysqldbcompare-to-compare-two-databases-in-replication\/\">http:\/\/scriptingmysql.wordpress.com\/2013\/01\/31\/using-mysql-utilities-workbench-script-mysqldbcompare-to-compare-two-databases-in-replication\/<\/a><\/div>\n<div><\/div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">mysqldbcompare --server1=root:passwd@1.1.1.1 \u00a0--server2=root:passwd&lt;a href=&quot;mailto:@2.2.2.2&quot;&gt;@2.2.2.2&lt;\/a&gt;\u00a0DevNewAge:DevNewAge --run-all-tests --changes-for=server2 --difftype=sql<\/pre>\n<div><\/div>\n<div>\u63d0\u793a\u4e2d\u51fa\u73b0\u9519\u8bef\u3002<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">mysqldbcompare\u00a0 ERROR: Query failed. 23 (HY000): Out of resources when opening file\r\n &lt;a href=&quot;http:\/\/forums.cpanel.net\/f354\/upgrade-mysql-5-5-sqlstate-hy000-general-error-23-out-resources-286172.html&quot;&gt;http:\/\/forums.cpanel.net\/f354\/upgrade-mysql-5-5-sqlstate-hy000-general-error-23-out-resources-286172.html<\/pre>\n<\/div>\n<div><b>\u62f7\u8d1d\u5e38\u7528\u7ba1\u7406\u811a\u672c<\/b><\/div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">rsync -PaAz -e 'ssh -p 123456' \/root\/scripts root@11.22.33.44:\/root\/<\/pre>\n<div><\/div>\n<div><b>\u62f7\u8d1dcrontab<\/b><\/div>\n<div>\u5047\u8bbe\u4f60\u548c\u6211\u4e00\u6837\uff0c\u53ea\u5728\u4e00\u4e2a\u7528\u6237\u91cc\u8bbe\u4e86crontab\uff0c\u5206\u522b\u5728\u65b0\u65e7\u4e24\u53f0\u673a\u5668\u4e0a\uff1a<\/div>\n<div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">crontab -e<\/pre>\n<\/div>\n<div>\u62f7\u8d1d\u5185\u5bb9\u3002<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u53f0\u8001\u670d\u52a1\u5668\u7528\u4e865\u5e74\u4e86\u3002\u4e3a\u4e86\u4fdd\u8bc1\u7a33\u5b9a\u6027\uff0c\u5728\u5b83\u51fa\u6bdb\u75c5\u4e4b\u524d\uff0c\u9884\u5148\u6362\u53f0\u65b0\u670d\u52a1\u5668\u3002 \u672c\u6587\u8bb0\u5f55\u4e86\u670d\u52a1\u5668\u8fc1\u79fb\u7684\u5168\u90e8\u8fc7\u7a0b\u3002  &hellip; <a href=\"https:\/\/ybzx.vip\/wp\/?p=1276\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">CentOS 6 Web\u670d\u52a1\u5668\u8fc1\u79fb<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[79,78,126],"class_list":["post-1276","post","type-post","status-publish","format-standard","hentry","category-network","tag-centos","tag-linux","tag-starred"],"_links":{"self":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1276"}],"version-history":[{"count":0,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1276\/revisions"}],"wp:attachment":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}