apisix安裝過程和坑

參考資料:

1、安裝依賴

$ wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -ivh epel-release-latest-7.noarch.rpm

添加OpenResty源

$ sudo yum install yum-utils
$ sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

安裝OpenResty

$ sudo yum install -y openresty

2、安裝etcd

方法一:apisix需要3.4的etcd。

yum installe etcd也可以安裝,你需要yum list etcd 先看看是不是3.4以上。

方法二:自己找半成品部署。

如果你是x86/centos,需要安裝amd64的版本。

$ wget https://github.com/etcd-io/etcd/releases/download/v3.4.15/etcd-v3.4.15-linux-arm64.tar.gz
$ tar -xvf etcd-v3.4.15-linux-amd64.tar.gz && \
    cd etcd-v3.4.15-linux-amd64 && \
    sudo cp -a etcd etcdctl /usr/bin/

安裝完要啟動etcd

$ systemctl start etcd

etcd默認端口是2379
如果起不來,那么你需要補etcd的配置和etcd.service,按照:
手動安裝etcd和配置 來操作。
確保所需的所有端口(默認的 9080/9443/2379);可以通過

netstat -anp | grep 2379 

來查找端口占用情況,并停止對方,以方便etcd啟動;如果對方不方便停止,那么就修改etcd的端口吧;

3、安裝apisix

3.1、下載安裝

$ sudo yum install -y https://github.com/apache/apisix/releases/download/2.5/apisix-2.5-0.x86_64.rpm

檢查 APISIX 的版本號:

$ apisix version

啟動 APISIX:
必須依賴etc>=3.4

$ apisix start

3.2、安裝dashboard

dashboard需要比apisix高0.1個版本。apisix=2.5,那么dashboard就是2.6。

$ sudo yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.6/apisix-dashboard-2.6-0.x86_64.rpm

3.3、配置dashboard

進入dashboard目錄

$ cd /usr/local/apisix/dashboard/conf

修改conf.yaml

$ vim conf.yaml

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

conf:
 listen:
   host: 127.0.0.1     # `manager api` listening ip or host name
   port: 9000          # `manager api` listening port
 allow_list:           # If we don't set any IP list, then any IP access is allowed by 
   default.
   - 127.0.0.1/24

修改host為0.0.0.0并注釋掉allow_list

conf:
  listen:
    host: 0.0.0.0     # `manager api` listening ip or host name
    port: 9000          # `manager api` listening port  
#allow_list:           # If we don't set any IP list, then any IP access is allowed by 
  #  default.
  #  - 127.0.0.1/24

3.4、啟動dashboard

$ sudo nohup manager-api -p /usr/local/apisix/dashboard/ &

3.5、訪問

在瀏覽器輸入http://hostip:9000,默認登錄用戶密碼均為admin

界面打開提示登錄

登錄成功進入主界面

3.6、運維

為了方便管理,寫個腳本來啟停:
start.sh

if [[ $1  == "start" ]];then
        nohup manager-api -p /usr/local/apisix/dashboard/ >> /tmp/apisix-dashboard.log 2>&1 &
        systemctl start etcd
elif [[ $1 == "kill" ]];then
        systemctl stop etcd
        ps -ef | grep "/usr/local/apisix/dashboard/" | grep manager-api | awk '{print $2}' | xargs kill -9 
        ps -ef | egrep "dashboard|etcd"
fi
ps -eo etime,pid,command | egrep "dashboard|etcd" | grep -v grep 
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容