mysql多實例部署

来源:https://www.cnblogs.com/Their-own/archive/2022/07/29/16532585.html
-Advertisement-
Play Games

1.軟體下載 [[email protected] ~]# cd /usr/src/ [[email protected] src]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86 ...


目錄

1.軟體下載

[[email protected] ~]# cd /usr/src/
[[email protected] src]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
--2022-07-29 13:28:14--  https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
Resolving cdn.mysql.com (cdn.mysql.com)... 23.2.84.230
Connecting to cdn.mysql.com (cdn.mysql.com)|23.2.84.230|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 674830866 (644M) [application/x-tar-gz]
Saving to: 'mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz'

mysql-5.7.38-linux-glibc2.12-x 100%[==================================================>] 643.57M  3.35MB/s    in 4m 15s  

2022-07-29 13:32:30 (2.52 MB/s) - 'mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz' saved [674830866/674830866]
[[email protected] src]# ls
debug  kernels  mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz

2.配置用戶和組並解壓二進位程式至/usr/local下

[[email protected] src]# useradd -M -r -s /sbin/nologin mysql
[[email protected] src]# id mysql
uid=995(mysql) gid=992(mysql) groups=992(mysql)
[[email protected] src]# tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[[email protected] src]# cd
[[email protected] ~]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  mysql-5.7.38-linux-glibc2.12-x86_64  sbin  share  src
[[email protected] ~]# cd /usr/local/
[[email protected] local]# ln -sv mysql-5.7.38-linux-glibc2.12-x86_64 mysql
'mysql' -> 'mysql-5.7.38-linux-glibc2.12-x86_64'
[[email protected] local]# ll
total 0
drwxr-xr-x. 2 root root   6 Jun 22  2021 bin
drwxr-xr-x. 2 root root   6 Jun 22  2021 etc
drwxr-xr-x. 2 root root   6 Jun 22  2021 games
drwxr-xr-x. 2 root root   6 Jun 22  2021 include
drwxr-xr-x. 2 root root   6 Jun 22  2021 lib
drwxr-xr-x. 3 root root  17 Jul 12 21:45 lib64
drwxr-xr-x. 2 root root   6 Jun 22  2021 libexec
lrwxrwxrwx. 1 root root  35 Jul 29 13:39 mysql -> mysql-5.7.38-linux-glibc2.12-x86_64
drwxr-xr-x. 9 root root 129 Jul 29 13:38 mysql-5.7.38-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root   6 Jun 22  2021 sbin
drwxr-xr-x. 5 root root  49 Jul 12 21:45 share
drwxr-xr-x. 2 root root   6 Jun 22  2021 src

//修改目錄/usr/local/mysql的屬主屬組
[[email protected] local]# chown -R mysql.mysql mysql*
[[email protected] local]# ll /usr/local/mysql -d
lrwxrwxrwx. 1 mysql mysql 35 Jul 29 13:39 /usr/local/mysql -> mysql-5.7.38-linux-glibc2.12-x86_64

//配置環境變數
[[email protected] local]# echo 'export PATH=$PATH:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh
[[email protected] local]# source /etc/profile.d/mysql.sh 
[[email protected] local]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin

//創建頭文件
[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# ls
LICENSE  README  bin  docs  include  lib  man  share  support-files

[[email protected] mysql]# ln -sv /usr/local/mysql/include/ /usr/include/mysql		//配置軟鏈接
'/usr/include/mysql' -> '/usr/local/mysql/include/'		
[[email protected] ~]# chown -R mysql.mysql /usr/include/mysql
[[email protected] ~]# ll -d /usr/include/mysql
lrwxrwxrwx. 1 mysql mysql 25 Jul 29 14:37 /usr/include/mysql -> /usr/local/mysql/include/

[[email protected] ~]# vim /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib/
[[email protected] ~]# ldconfig
[[email protected] ~]# vim /etc/man_db.conf 
#MANDATORY_MANPATH                      /usr/src/pvm3/man
#
MANDATORY_MANPATH                       /usr/man
MANDATORY_MANPATH                       /usr/share/man
MANDATORY_MANPATH                       /usr/local/share/man
MANDATORY_MANPATH                       /usr/local/mysql/man		//添加一行

3.創建各實例數據存放的目錄

[[email protected] ~]# mkdir -p /opt/data/{3306,3307,3308}
[[email protected] ~]# chown -R mysql.mysql /opt/data/
[[email protected] ~]# ll /opt/data/
total 0
drwxr-xr-x. 2 mysql mysql 6 Jul 29 13:45 3306
drwxr-xr-x. 2 mysql mysql 6 Jul 29 13:45 3307
drwxr-xr-x. 2 mysql mysql 6 Jul 29 13:45 3308
[[email protected] ~]# tree /opt/data/
/opt/data/
|-- 3306
|-- 3307
`-- 3308

4.初始化各示例

//初始化3306
[[email protected] ~]# mysqld --initialize --user mysql --datadir /opt/data/3306
2022-07-29T05:48:04.206397Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-29T05:48:04.369296Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-29T05:48:04.403256Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-29T05:48:04.462960Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 03b0e61e-0f02-11ed-b4ce-000c296d5362.
2022-07-29T05:48:04.464340Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-29T05:48:04.643259Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:48:04.643284Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:48:04.643585Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-29T05:48:04.717924Z 1 [Note] A temporary password is generated for [email protected]: ,dASzpwwE3RJ
[[email protected] ~]# echo ',dASzpwwE3RJ' > 3306
[[email protected] ~]# ls
3306  anaconda-ks.cfg


//初始化3307
[[email protected] ~]# mysqld --initialize --user mysql --datadir /opt/data/3307
2022-07-29T05:49:29.037700Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-29T05:49:29.195218Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-29T05:49:29.224130Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-29T05:49:29.281903Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 363f3e1c-0f02-11ed-8fdd-000c296d5362.
2022-07-29T05:49:29.283175Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-29T05:49:29.523082Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:49:29.523118Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:49:29.523503Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-29T05:49:29.581009Z 1 [Note] A temporary password is generated for [email protected]: )MhldlF<o23j
[[email protected] ~]# echo ')MhldlF<o23j' > 3307
[[email protected] ~]# ls
3306  3307  anaconda-ks.cfg


//初始化3308
[[email protected] ~]# mysqld --initialize --user mysql --datadir /opt/data/3308
2022-07-29T05:50:14.735254Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-29T05:50:14.892190Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-29T05:50:14.915269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-29T05:50:14.973272Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 517b3121-0f02-11ed-a3f6-000c296d5362.
2022-07-29T05:50:14.974697Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-29T05:50:15.340479Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:50:15.340510Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-29T05:50:15.341068Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-29T05:50:15.368072Z 1 [Note] A temporary password is generated for [email protected]: tkdnhiEk>5vh
[[email protected] ~]# echo 'tkdnhiEk>5vh' > 3308
[[email protected] ~]# ls
3306  3307  3308  anaconda-ks.cfg

5.配置配置文件/etc/my.cnf

[[email protected] ~]# vim /etc/my.cnf
[[email protected] ~]# cat /etc/my.cnf
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin

[mysqld3306]
datadir = /opt/data/3306
port = 3306
socket = /tmp/mysql3306.sock
pid-file = /opt/data/3306/mysql_3306.pid
log-error=/var/log/3306.log

[mysqld3307]
datadir = /opt/data/3307
port = 3307
socket = /tmp/mysql3307.sock
pid-file = /opt/data/3307/mysql_3307.pid
log-error=/var/log/3307.log

[mysqld3308]
datadir = /opt/data/3308
port = 3308
socket = /tmp/mysql3308.sock
pid-file = /opt/data/3308/mysql_3308.pid
log-error=/var/log/3308.log

6.啟動各示例

[[email protected] ~]# mysqld_multi start 3306
-bash: /usr/local/mysql/bin/mysqld_multi: /usr/bin/perl: bad interpreter: No such file or directory				//需要下載perl包
[[email protected] ~]# dnf -y install perl
[[email protected] mysql]# yum install ncurses-compat-libs
[[email protected] mysql]# file /usr/local/mysql/bin/mysqld_multi
/usr/local/mysql/bin/mysqld_multi: Perl script text executable
[[email protected] ~]# mysqld_multi start 3306
[[email protected] ~]# mysqld_multi start 3307
[[email protected] ~]# mysqld_multi start 3308
[[email protected] ~]# ss -anlt
State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port        Process        
LISTEN        0             128                        0.0.0.0:22                      0.0.0.0:*                          
LISTEN        0             80                               *:3308                          *:*                          
LISTEN        0             128                           [::]:22                         [::]:*                          
LISTEN        0             80                               *:3306                          *:*                          
LISTEN        0             80                               *:3307                          *:*                          

7.使用system控制啟動

//需要先把mysql服務停止 //mysqld_mulit 命令停止不了只能殺進程
[[email protected] ~]# ps -ef | grep 3306 | grep -v grep
root       77016       1  0 13:55 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data/3306 --port=3306 --socket=/tmp/mysql3306.sock --pid-file=/opt/data/3306/mysql_3306.pid --log-error=/var/log/3306.log
mysql      77152   77016  0 13:55 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data/3306 --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/3306.log --pid-file=/opt/data/3306/mysql_3306.pid --socket=/tmp/mysql3306.sock --port=3306
[[email protected] ~]# ps -ef | grep 3306 | grep -v grep | awk '{print$2}'
77016
77152
[[email protected] ~]# ps -ef | grep 3306 | grep -v grep | awk '{print$2}' | xargs kill -9
[[email protected] ~]# ss -anlt
State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port        Process        
LISTEN        0             128                        0.0.0.0:22                      0.0.0.0:*                          
LISTEN        0             80                               *:3308                          *:*                          
LISTEN        0             128                           [::]:22                         [::]:*                          
LISTEN        0             80                               *:3307                          *:*                          
[[email protected] ~]# ps -ef | grep 3307 | grep -v grep | awk '{print$2}' | xargs kill -9
[[email protected] ~]# ss -anlt
State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port        Process        
LISTEN        0             128                        0.0.0.0:22                      0.0.0.0:*                          
LISTEN        0             80                               *:3308                          *:*                          
LISTEN        0             128                           [::]:22                         [::]:*                          
[[email protected] ~]# ps -ef | grep 3308 | grep -v grep | awk '{print$2}' | xargs kill -9
[[email protected] ~]# ss -anlt
State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port        Process        
LISTEN        0             128                        0.0.0.0:22                      0.0.0.0:*                          
LISTEN        0             128                           [::]:22                         [::]:*                         

//找個一個系統預設可以使用system控制的配置文件進行cp一下,併進行修改
[[email protected] ~]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/3306.service

//配置3306
[[email protected] ~]# vim /usr/lib/systemd/system/3306.service
[Unit]
Description=3306 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3306
ExecStop=ps -ef | grep 3306 | grep -v grep | awk '{print$2}' | xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

//配置3307
[[email protected] ~]# cp /usr/lib/systemd/system/3306.service /usr/lib/systemd/system/3307.service
[[email protected] ~]# vim /usr/lib/systemd/system/3307.service    //使用:% s/6/7/g一鍵替換
[Unit]
Description=3307 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3307
ExecStop=ps -ef | grep 3307 | grep -v grep | awk '{print$2}' | xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target


//配置3308
[[email protected] ~]# cp /usr/lib/systemd/system/3306.service /usr/lib/systemd/system/3308.service
[[email protected] ~]# vim /usr/lib/systemd/system/3308.service     //使用:% s/6/7/g一鍵替換
[Unit]
Description=3308 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3308
ExecStop=ps -ef | grep 3308 | grep -v grep | awk '{print$2}' | xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

//刷新一下
[[email protected] ~]# systemctl daemon-reload		

//關閉防火牆和selinux
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] ~]# setenforce 0
[[email protected] ~]# vim /etc/selinux/config 
SELINUX=disabled

//啟動3306,3307,3308
[[email protected] ~]# systemctl start 3306
Job for 3306.service failed because the control process exited with error code.
See "systemctl status 3306.service" and "journalctl -xe" for details.  //沒有找到my_print_defaults這個文件

//創建一個軟鏈接到/usr/bin下
[[email protected] ~]# ln -s /usr/local/mysql/bin/my_print_defaults /usr/bin/my_print_defaults
[[email protected] ~]# systemctl start 3306
[[email protected] ~]# systemctl start 3307
[[email protected] ~]# systemctl start 3308
[[email protected] ~]# ss -anlt
State         Recv-Q        Send-Q               Local Address:Port               Peer Address:Port        Process        
LISTEN        0             128                        0.0.0.0:22                      0.0.0.0:*                          
LISTEN        0             80                               *:3308                          *:*                          
LISTEN        0             128                           [::]:22                         [::]:*                          
LISTEN        0             80                               *:3306                          *:*                          
LISTEN        0             80                               *:3307                          *:*                          

8.初始化密碼

//3306
[[email protected] ~]# mysql -uroot -p',dASzpwwE3RJ' -S /tmp/mysql.sock
mysql> set password = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

//3307
[[email protected] ~]# mysql -uroot -p')MhldlF<o23j' -S /tmp/mysql3307.sock
mysql> set password = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

//3308
[[email protected] ~]# mysql -uroot -p'tkdnhiEk>5vh' -S /tmp/mysql3308.sock
mysql> set password = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 如何對Linux進行擴容: 1、在VM上添加硬碟 2、使用lsblk,查看新增的磁碟 3、使用fdisk /dev/sdd,對新增磁碟sdd進行磁碟分區 依次輸入,n,p,w 4、查看新創建出來的分區 lsblk 5、對新創建出來的分區,創建PV,pvcreate /dev/sdd1 6、使用 pv ...
  • Linux系統基礎(一) Linux的基本原則: 由目的單一的小程式組成,組合小程式完成複雜任務; 一切皆文件; 配置文件保存為純文本格式。 1、shell 1.1 shell簡介 Shell俗稱殼(用來區別於核),是指“為使用者提供操作界面”的軟體(命令解析器)。它類似於DOS下的command. ...
  • 1、文件目錄結構 /:是Linux系統的根目錄 /bin:存放用戶經常使用的命令 /boot:啟動載入程式的靜態文件 /dev:設備文件目錄,不能單獨分區 /etc:系統配置文件目錄 /home:普通用戶的家目錄 /root:系統管理員的家目錄 /run:進程的運行數據存放的目錄 /sbin:存放系 ...
  • Logic Pro X Mac版是一款專業音頻製作軟體,作為Mac上功能完備的專業錄音室,Logic Pro X為音樂人提供了從創作第一個音符到完成最後的母帶所需的一切。它為您帶來的軟體樂器與音頻處理插件足以讓您製作任何風格的音樂! 詳情:Logic Pro X for Mac(專業級音頻製作軟體) ...
  • MDK ARM 5.28 之後包括 5.37 的版本. 這些版本即使勾選 Reset And Run, 在燒錄後也不會自動重啟執行 需要做以下設置 Debug -> ST-Link Debugger -> Settings 切換到 Pack 標簽頁, 取消勾選 Enable 點擊 OK 保存. 不能... ...
  • 寫在前面 本系列的文章是博主邊學邊記錄的,可能不是特別的正確,因為會加上博主自己的理解,僅供參考。 正文: 為了能夠將用戶程式裝入記憶體,必須為它分配一定大小的記憶體空間。常見的分配方式有: 1.連續分配 連續分配方式是最早出現的一種存儲器分配方式,該分配方式為一個用戶程式分配一個連續的記憶體空間。常見的 ...
  • 文本編輯工具VIM 1.vi/vim介紹 我們要學會如何去新建文件、刪除文件、修改文件等等,那麼做這些操作就需要一個文本編輯工具。而在linux中最經典最流行的文本編輯工具就是vi/vim,當然也有一些其他的文本編輯工具。 例如 emacs pico nano joe jed 諸如此類,但我們只需要 ...
  • SiteSucker for Mac是一款運行在Mac平臺上的整站下載工具,在SiteSucker Mac版中輸入網址就能離線下載一個網站里的所有內容,包括HTML、圖片、CSS 樣式表、JS 文件、Flash 文件等,SiteSucker for mac版的操作十分簡單,非常的實用。 詳情:Sit ...
一周排行
    -Advertisement-
    Play Games
  • Github / Gitee QQ群(1群) : 813100564 / QQ群(2群) : 579033769 視頻教學 介紹 MiniWord .NET Word模板引擎,藉由Word模板和數據簡單、快速生成文件。 Getting Started 安裝 nuget link : https:// ...
  • Array.Sort Array類中相當實用的我認為是Sort方法,相比起冗長的冒泡排序,它的出現讓排序更加的簡化 結果如下: 還可以聲明一個靜態方法用來專門調用指定數組排序,從名為 array 的一維數組中 a 索引處開始,到 b 元素 從小到大排序。 註意: a + b 不能大於 array 的 ...
  • 前言 在上一篇文章CLR類型系統概述里提到,當運行時掛起時, 垃圾回收會執行堆棧遍歷器(stack walker)去拿到堆棧上值類型的大小和堆棧根。這裡我們來翻譯BotR里一篇專門介紹Stackwalking的文章,希望能加深理解。 順便說一句,StackWalker在中文里似乎還沒有統一的翻譯,J ...
  • 使用過 nginx 的小伙伴應該都知道,這個中間件是可以設置跨域的,作為今天的主角,同樣的 反向代理中間件的 YARP 毫無意外也支持了跨域請求設置。 有些小伙伴可能會問了,怎樣才算是跨域呢? 在 HTML 中,一些標簽,例如 img、a 等,還有我們非常熟悉的 Ajax,都是可以指向非本站的資源的 ...
  • 什麼是Git Git 是一個開源的分散式版本控制系統,用於敏捷高效地處理任何或小或大的項目。 Git 是 Linus Torvalds 為了幫助管理 Linux 內核開發而開發的一個開放源碼的版本控制軟體。 Git 與常用的版本控制工具 CVS, Subversion 等不同,它採用了分散式版本庫的 ...
  • 首先CR3是什麼,CR3是一個寄存器,該寄存器內保存有頁目錄表物理地址(PDBR地址),其實CR3內部存放的就是頁目錄表的記憶體基地址,運用CR3切換可實現對特定進程記憶體地址的強制讀寫操作,此類讀寫屬於有痕讀寫,多數驅動保護都會將這個地址改為無效,此時CR3讀寫就失效了,當然如果能找到CR3的正確地址... ...
  • 說明 onlyoffice為一款開源的office線上編輯組件,提供word/excel/ppt編輯保存操作 以下操作均基於centos8系統,officeonly鏡像版本7.1.2.23 鏡像下載地址:https://yunpan.360.cn/surl_y87CKKcPdY4 (提取碼:1f92 ...
  • 二叉樹查找指定的節點 前序查找的思路 1.先判斷當前節點的no是否等於要查找的 2.如果是相等,則返回當前節點 3.如果不等,則判斷當前節點的左子節點是否為空,如果不為空,則遞歸前序查找 4.如果左遞歸前序查找,找到節點,則返回,否繼續判斷,當前的節點的右子節點是否為空,如果不為空,則繼續向右遞歸前 ...
  • ##Invalid bound statement (not found)出現原因和解決方法 ###前言: 想必各位小伙伴在碼路上經常會碰到奇奇怪怪的事情,比如出現Invalid bound statement (not found),那今天我就來分析以下出現此問題的原因。 其實出現這個問題實質就是 ...
  • ###一、背景知識 爬蟲的本質就是一個socket客戶端與服務端的通信過程,如果我們有多個url待爬取,只用一個線程且採用串列的方式執行,那隻能等待爬取一個結束後才能繼續下一個,效率會非常低。 需要強調的是:對於單線程下串列N個任務,並不完全等同於低效,如果這N個任務都是純計算的任務,那麼該線程對c ...