在CentOS上以源碼編譯的方式安裝Greenplum資料庫

来源:https://www.cnblogs.com/glowworm/archive/2018/02/10/8437923.html
-Advertisement-
Play Games

集群組成: 一臺主機,一臺從節點。 系統環境: 操作系統:CentOS 7,64位,7.4.1708(/etc/redhat-release中查看) CPU:AMD Fx-8300 8核 記憶體:8GB 硬碟:120GB GNOME:3.22.2 安裝版本: GPDB:V5.4.1 GPORCA:V2 ...


集群組成:

  一臺主機,一臺從節點。

系統環境:

  操作系統:CentOS 7,64位,7.4.1708(/etc/redhat-release中查看)

  CPU:AMD Fx-8300 8核

  記憶體:8GB

  硬碟:120GB

  GNOME:3.22.2

安裝版本:

  GPDB:V5.4.1

  GPORCA:V2.53.11

 

經驗參考:
  http://www.jishux.com/plus/view-683368-1.html
  https://www.cnblogs.com/arthurqin/p/5849354.html
  http://www.jpblog.cn/greenplum%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85.html

 

前提條件:禁用防火牆(所有節點和主機都要禁用!!)

使用root賬號執行下列命令(同時禁用預設的防火牆和可能已經安裝的iptables,共兩個防火牆程式):

關閉預設的防火牆

# systemctl stop firewalld

屏蔽預設的防火牆(重啟後也不會啟動)

# systemctl mask firewalld

關閉iptables

# systemctl stop iptables

禁用iptables

# systemctl disable iptables

 

安裝過程

一)創建專有賬號gpdba,並加入root用戶組。

下麵所有操作都使用gpdba賬號來執行!如果操作失敗,則使用root賬號。

 

二)修改所有伺服器的主機名(所有節點和主機)

 

1)修改hosts使用命令 vi /etc/hosts 來修改

 

127.0.0.1 localhost localhost.localdomain

 

192.168.58.102 Master shsm002

 

192.168.58.104 Slave1 shsm004

 

最後,再輸入 source /etc/profile 刷新。

 

2)修改network文件,輸入命令vi /etc/sysconfig/network

 

NETWORKING=yes
HOSTNAME=對應的主機名稱

 

3)如果主機名稱與設備名稱不符,則按照下列格式修改:

 

127.0.0.1 localhost localhost.localdomain

 

IP地址 主機名稱 設備名稱
最後使用ping命令驗證是否可以連通。

 

三)修改系統文件(所有節點和主機)

1)修改內核配置

vi /etc/sysctl.conf,添加下麵內容:

kernel.shmmax = 5000000000

kernel.shmmni = 4096

kernel.shmall = 4000000000

kernel.sem = 250 512000 100 2048

kernel.sysrq = 1

kernel.core_uses_pid = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.msgmni = 2048

net.ipv4.tcp_syncookies = 1

net.ipv4.ip_forward = 0

net.ipv4.conf.default.accept_source_route = 0

net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_max_syn_backlog = 4096

net.ipv4.conf.all.arp_filter = 1

net.ipv4.ip_local_port_range = 1025 65535

net.core.netdev_max_backlog = 10000

net.core.rmem_max = 2097152

net.core.wmem_max = 2097152

vm.overcommit_memory = 2

執行命令 sysctl -p 使修改數值生效

2)修改限制配置

vi /etc/security/limits.conf

添加下麵內容:

* soft nofile 65536

* hard nofile 65536

* soft nproc 131072

* hard nproc 131072
3)禁用SELINUX

vi /etc/selinux/config,修改SELINUX的值為disabled。修改後,如下:

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

# targeted - Targeted processes are protected,

# mls - Multi Level Security protection.

SELINUXTYPE=targeted


三)安裝優化器GPORCA的依賴項(所有節點和主機)

1)安裝cmake(3.10.2)

下載:
$ wget http://www.cmake.org/files/v3.10/cmake-3.10.2.tar.gz
解壓:
$ tar xzf cmake-3.10.2.tar.gz

定位到解壓後的目錄中:
$ cd cmake-3.10.2
關於configure命令:
如果要查看詳細的配置選項,使用下麵命令:

$ ./configure --help
執行配置命令(安裝到目錄/usr/cmake):

$ ./configure --prefix=/usr/cmake

編譯:
$ make
安裝:
# make install
最後進行驗證:
$ /usr/cmake/bin/cmake -version

輸出類似下麵內容顯示出版本號:
cmake version 3.10.2

編輯修改/etc/profile文件,將cmake添加到環境變數定義中,添加下麵內容:

  ### CMAKE 3.10 ###
  export PATH=/usr/cmake/bin:$PATH

2)安裝gp-xerces

使用gpdba賬號解壓源碼文件壓縮包,進入解壓目錄,執行下麵命令。
mkdir build
cd build
../configure --prefix=/usr/local  ##安裝到/usr/local目錄下
(註意:如果出錯,則使用root賬號執行下麵的make命令)
make
make install

3)安裝re2c(1.0.3)

進入 http://re2c.org/install/install.html 頁面下載自己需要的版本
安裝re2c是由於配置ninja時需要
$ ./configure --prefix=/usr/local
(註意:使用root賬號執行下麵的make命令;如果用戶沒有在root用戶組中時)
$ make
$ make install

4)安裝Ninja

可以使用git下載:https://github.com/ninja-build/ninja.git
下載後進入ninja目錄執行如下命令:
./configure.py --bootstrap
由於最終結果只是一個二進位文件ninja,之後使用root賬號拷貝ninja文件到/usr/bin目錄即可(/usr/bin目錄已經在環境變數PATH中配置定義了)
Installation is not necessary because the only required file is the resulting ninja binary. However, to enable features like Bash completion and Emacs and Vim editing modes, some files in misc/ must be copied to appropriate locations.

特別說明:先在主機上安裝所有依賴項的程式,然後通過scp命令遠程複製安裝包或壓縮包到其他節點上逐個執行安裝。

四)安裝GPORCA

下載地址:https://github.com/greenplum-db/gporca

安裝GPORCA(GPDB-5.4.1對應的依賴版本,2.53.11)
使用gpdba賬號解壓源碼文件壓縮包,進入解壓目錄,執行下麵命令。
cmake -GNinja -H. -Bbuild
ninja install -C build

查看GPDB依賴的ORCA的版本信息:/gpdb-5.4.1/depends/conanfile_orca.txt文件
[requires]
orca/v2.53.11@gpdb/stable

 

安裝完成後,進入/gporca/build目錄,執行ctest命令進行檢查
如果最後輸出類似如下結果:
100% tests passed, 0 tests failed out of 119

Total Test time (real) = 195.48 sec
這說明編譯成功了。

【刪除舊版的GPORCA】
進入源文件目錄下,執行命令
rm -rf build/*
rm -rf /usr/local/include/naucrates
rm -rf /usr/local/include/gpdbcost
rm -rf /usr/local/include/gpopt
rm -rf /usr/local/include/gpos
rm -rf /usr/local/lib/libnaucrates.so*
rm -rf /usr/local/lib/libgpdbcost.so*
rm -rf /usr/local/lib/libgpopt.so*
rm -rf /usr/local/lib/libgpos.so*

 

五)安裝GPDB(選擇版本5.4.1)

1)使用root賬號安裝依賴項

sudo yum install -y epel-release

sudo yum install -y apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ krb5-devel libcurl-devel libevent-devel libkadm5 libyaml-devel libxml2-devel perl-ExtUtils-Embed python-devel python-paramiko python-pip python-psutil python-setuptools readline-devel xerces-c-devel zlib-devel

# Install lockfile with pip because the yum package `python-pip` is too old (0.8).
sudo pip install lockfile conan

2)下載源代碼文件,解壓後編譯安裝。

使用gpdba賬號進入下載解壓的源文件目錄下,執行命令(prefix後面的路徑/usr/gpdb是安裝目錄)
./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/gpdb
如果沒有安裝ORCA,則可以使用:./configure --with-perl --with-python --with-libxml --with-gssapi --disable-orca --prefix=/usr/gpdb

然後執行make
make -j8

最後執行安裝
make -j8 install

3)分發

首先,創建伺服器之間的ssh免密連接。

創建目錄/usr/gpdb-conf,在該目錄中創建主機清單文件hostlist,文件內容如下:

  Master

  Salve1

然後繼續在gpdb-conf目錄中創建seg_hosts,文件內容如下:

  Slave1

刷新greenplum_path的配置

source /usr/gpdb/greenplum_path.sh

gpssh交換密鑰

gpssh-exkeys -f /usr/gpdb-conf/hostlist

 

最後,將安裝成功的文件夾壓縮打包

gtar -cvf /home/gpdba/gpdb-install-binary-5.4.1.tar /usr/gpdb

使用gpscp命令複製到其他節點上(或者先ssh後scp也可以)

gpscp -f /usr/gpdb-conf/seg_hosts /home/gpdba/gpdb-install-binary-5.4.1.tar =:/usr

使用gpssh連接主機與從節點,解壓tar文件,安裝路徑同主機的安裝路徑保持一致。

gpssh -f /usr/gpdb-conf/hostlist

master 節點連接 slave 節點之後,執行所有命令都應該有n份輸出才表示正常。

解壓文件

gtar -xvf gpdb-install-binary-5.4.1.tar

創建資料庫工作目錄

cd /home/gpdba/gpdata

mkdir gpdatap1 gpdatap2 gpdatam1 gpdatam2 gpmaster

4)初始化資料庫(在master主機)

配置bash_profile環境變數

vi .bash_profile

修改如下:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

## Greenplum Database
source /usr/gpdb/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/gpdba/gpdata/gpmaster/gpseg-1
export PGPORT=2346
export PGDATABASE=testDB

保存後,刷新生效:

. ~/.bash_profile

配置資料庫的啟動參數

將/usr/gpdb/docs/cli_help/gpconfigs/gpinitsystem_config 文件 複製到 /usr/gpdb-conf 目錄下然後編輯,保留如下內容:

# FILE NAME: gpinitsystem_config

# Configuration file needed by the gpinitsystem

################################################
#### REQUIRED PARAMETERS
################################################

#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="Greenplum Data Platform"

#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg

#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=40000

#### File system location(s) where primary segment data directories
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per
#### physical host (if multiple addresses for a host are listed in
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/data1/primary /data1/primary /data1/primary /data2/primary /data2/primary /data2/primary)

#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=mdw

#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/data/master

#### Port number for the master instance.
MASTER_PORT=5432

#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh

#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8

#### Default server-side character set encoding.
ENCODING=UNICODE

################################################
#### OPTIONAL MIRROR PARAMETERS
################################################

#### Base number by which mirror segment port numbers
#### are calculated.
#MIRROR_PORT_BASE=50000

#### Base number by which primary file replication port
#### numbers are calculated.
#REPLICATION_PORT_BASE=41000

#### Base number by which mirror file replication port
#### numbers are calculated.
#MIRROR_REPLICATION_PORT_BASE=51000

#### File system location(s) where mirror segment data directories
#### will be created. The number of mirror locations must equal the
#### number of primary locations as specified in the
#### DATA_DIRECTORY parameter.
#declare -a MIRROR_DATA_DIRECTORY=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)


################################################
#### OTHER OPTIONAL PARAMETERS
################################################

#### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database

#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem

最後,執行命令開始初始化:

gpinitsystem -c /usr/gpdb-conf/gpinitsystem_config -a

 

特別說明:如果初始化執行失敗之後,再次執行初始化,則需要先執行下麵命令進行環境重置:

查詢並關閉配置指定埠的postgres進程

刪除生成的未完成的資料庫文件(可能是所有節點伺服器),/home/gpdba/gpdata/gpmaster/gpseg-1文件夾。

六)錯誤解決

錯誤:
[gpdba@shsm002 ~]$ gpssh-exkeys -f /usr/gpdb-conf/hostlist
Error: unable to import module: version conflict: '/usr/lib64/python2.7/site-packages/psutil/_psutil_linux.so' C extension module was built for another version of psutil (different than 2.2.1)
解決:重新安裝psutil。sudo pip install psutil==2.2.1


錯誤:
20180129:23:40:43:gpinitsystem:shsm002:gpdba-[FATAL]:-Found indication of postmaster process on port 2345 on Master host Script Exiting!
解決:關閉殺死占用埠2345的進程。
先查詢進程
$ lsof -i:2345

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

postgres 10738 gpadmin 3u IPv4 264510 0t0 TCP *:postgres (LISTEN)
postgres 10738 gpadmin 4u IPv6 264511 0t0 TCP *:postgres (LISTEN)
然後殺死進程
$ kill -9 10738


錯誤:
20180207:00:14:09:005166 gpinitsystem:shsm002:gpdba-[INFO]:-Building the Master instance database, please wait...
20180207:00:14:17:005166 gpinitsystem:shsm002:gpdba-[INFO]:-Starting the Master in admin mode
20180207:00:14:23:gpinitsystem:shsm002:gpdba-[FATAL]:-Unknown host shsm004 Script Exiting!
20180207:00:14:23:005166 gpinitsystem:shsm002:gpdba-[WARN]:-Script has left Greenplum Database in an incomplete state
原因:hostname與用戶賬號的@後面的主機名稱不一致,hosts定義中也沒有shsm004,添加進去即可。
解決:修改hosts文件,每行記錄為:IP地址 主機名 功能變數名稱。將hostname數值shsm004放到功能變數名稱欄位保存即可。使用ping命令可以ping通。

 

錯誤:
20180207:00:05:00:003516 gpinitsystem:shsm002:gpdba-[INFO]:-Checking Master host
20180207:00:05:00:003516 gpinitsystem:shsm002:gpdba-[WARN]:-Have lock file /tmp/.s.PGSQL.2346.lock but no process running on port 2346
20180207:00:05:00:gpinitsystem:shsm002:gpdba-[FATAL]:-Found indication of postmaster process on port 2346 on Master host Script Exiting!
解決:刪除文件,rm /tmp/.s.PGSQL.2346.lock。


錯誤:
[gpdba@shsm002 ~]$ /bin/bash /home/gpdba/gpAdminLogs/backout_gpinitsystem_gpdba_20180207_225128
[FATAL]:-Not on original master host Master, backout script exiting!
解決:不使用這個腳本清理中間數據,直接刪除gpdata目錄下的未完成的資料庫文件即可。

 

錯誤:
20180207:23:39:31:028691 gpcreateseg.sh:shsm002:gpdba-[INFO][1]:-Start Function PROCESS_QE
20180207:23:39:31:028691 gpcreateseg.sh:shsm002:gpdba-[INFO][1]:-Processing segment Slave1
/usr/gpdb/bin/postgres: error while loading shared libraries: libgpopt.so.3: cannot open shared object file: No such file or directory
no data was returned by command ""/usr/gpdb/bin/postgres" -V"
The program "postgres" is needed by initdb but was either not found in the same directory as "/usr/gpdb/bin/initdb" or failed unexpectedly.
Check your installation; "postgres -V" may have more information.
/usr/gpdb/bin/postgres: error while loading shared libraries: libgpopt.so.3: cannot open shared object file: No such file or directory
no data was returned by command ""/usr/gpdb/bin/postgres" -V"
The program "postgres" is needed by initdb but was either not found in the same directory as "/usr/gpdb/bin/initdb" or failed unexpectedly.
Check your installation; "postgres -V" may have more information.
cat: /home/gpdba/gpdata/gpdatap1/gpseg0.initdb: No such file or directory
cat: /home/gpdba/gpdata/gpdatap2/gpseg1.initdb: No such file or directory
解決:修改/usr/gpdb/greenplum_path.sh文件,添加libgpopt.so.3文件所在目錄到環境變數LD_LIBRARY_PATH定義中,然後執行source命令刷新(在重啟電腦之前,可能每次打開終端命令行時都需要手動刷新一下)。修改後的文件內容如下:

GPHOME=/usr/gpdb

# Replace with symlink path if it is present and correct
if [ -h ${GPHOME}/../greenplum-db ]; then
GPHOME_BY_SYMLINK=`(cd ${GPHOME}/../greenplum-db/ && pwd -P)`
if [ x"${GPHOME_BY_SYMLINK}" = x"${GPHOME}" ]; then
GPHOME=`(cd ${GPHOME}/../greenplum-db/ && pwd -L)`/.
fi
unset GPHOME_BY_SYMLINK
fi
#setup PYTHONHOME
if [ -x $GPHOME/ext/python/bin/python ]; then
PYTHONHOME="$GPHOME/ext/python"
fi
PYTHONPATH=$GPHOME/lib/python
PATH=$GPHOME/bin:$PYTHONHOME/bin:$PATH
LD_LIBRARY_PATH=$GPHOME/lib:/usr/local/lib:${LD_LIBRARY_PATH-}
export LD_LIBRARY_PATH
OPENSSL_CONF=$GPHOME/etc/openssl.cnf
export GPHOME
export PATH
export PYTHONPATH
export PYTHONHOME
export OPENSSL_CONF


錯誤:
20180208:01:57:59:012804 gpinitsystem:shsm002:gpdba-[INFO]:-Start Function CREATE_DATABASE
psql: FATAL: DTM initialization: failure during startup recovery, retry failed, check segment status (cdbtm.c:1513)
20180208:01:58:00:012804 gpinitsystem:shsm002:gpdba-[INFO]:-Start Function ERROR_CHK
20180208:01:58:00:012804 gpinitsystem:shsm002:gpdba-[INFO]:-End Function ERROR_CHK
20180208:01:58:00:012804 gpinitsystem:shsm002:gpdba-[INFO]:-Start Function ERROR_EXIT
20180208:01:58:00:gpinitsystem:shsm002:gpdba-[FATAL]:-Failed to complete create database testDB Script Exiting!
解決:關閉並禁用防火牆(所有的防火牆程式)
運行命令:
# systemctl stop firewalld
# systemctl mask firewalld
# systemctl stop iptables
# systemctl disable iptables
另一種方法供參考:shared_buffers設置太大,對於如何根據自己記憶體和segment節點個數分配shared_buffers,可以去官網找一下,通常出去2g的other,以及statement_mem * segment 個數,剩下的除以segment的個數即可。這種情況通常出現中安裝過程中就設置了shared_buffers,一般預設的125MB。


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

-Advertisement-
Play Games
更多相關文章
  • 實例產品源碼下載地址:http://www.jinhusns.com/Products/Download ...
  • 學習筆記一:壓縮 學習筆記一:壓縮 2015年2月5日 上午 10:23 2015年2月5日 上午 10:23 壓縮命令 壓縮文件的擴展名大多是*.tar、*.tar.gz、*.tgz、*.gz、*.Z、*.bz2 常見的壓縮命令gzip與bzip2,其中bzip2壓縮比gzip要好 tar可以用來 ...
  • 升級10.13.2後,很多不會操作了, 那天把系統管理員設置成了普通管理,就不能打開個別軟體了, 賊尷尬~~~ 後來找blog才解決,現在分享下~~ http://www.cnblogs.com/ZZY0808/p/8430987.html 前因 今天不知怎麼就想把蘋果電腦原來的名字給改一下,於是就 ...
  • 1. JasperReport介紹 JasperReport 是一個開源的Java報表引擎,它不像其他的報表工具,例如Crystal報表是基於Java的,沒有自己的表達式語法。Jasper Reports有提供豐富的內容到屏幕上,到印表機,或轉換成PDF,HTML,XLS,RTF,ODT,CSV,T ...
  • 繼續上一個鏈接內容所講:http://www.cnblogs.com/linhaostudy/p/8430583.html 下麵bmp18x sensor為例進行分析。 BMP18x Sensor: 我們以打開bmp180為例,代碼為hardware\qcom\sensors\Bmp180.cpp: ...
  • 高通的HAL層其實分為兩種,一種是直接從kernel這邊報數據上來的,由sensor HAL層來監聽,另一種是走ADSP的模式,HAL層是通過qmi的形式進行監聽的; 走ADSP架構的可以看下麵的博客:http://blog.csdn.net/u011006622/article/details/5 ...
  • 1.從官網中下載apache-tomcat-**.tar.gz文件 2.在本地文件新建一個文件夾(tomcat),在文件夾中解壓壓縮包, 不需要使用root: 3.進入解壓文件中使用命令,將tomcat中的文件全部設置添加讀寫許可權: 4. 進入tomcat的conf文件夾下,找到tomcat-use ...
  • 1、切換用戶 命令:su - paytest,回車輸入密碼。 2、查看文件系統 命令:df -a (用於查看文件系統的使用情況) 命令:du -shx * (用於列出所有文件夾的大小) 命令:df -h 顯示已經掛載的分區列表 命令:ls -lSr |more 以尺寸大小排列文件和目錄 命令:du ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...