新手学习开源项目zheng环境部署
zheng項目部署啟動
一,環境搭建所需要的軟件
二,導入項目
打開IDEA---->File---->New---->Module from Existing Sources導入一個存在的Module
選擇Import module from external model --> Maven 成功導入
三,軟件的安裝
這里就不介紹安裝jdk,idel,maven,tomcat了,網上有很多教程可以自行搜索。
3.1 redis的安裝
redis安裝包
然后要安裝redis可視化工具(目前官網要收費了):添加鏈接描述
安裝完成后
redis自己重新設置密碼
3.2 Zookeeper安裝
下載鏈接:添加鏈接描述
3.3 ActiveMQ
下載鏈接:添加鏈接描述
3.4 Nginx
下載鏈接:添加鏈接描述
四,運行項目
后臺啟動:
(一), 初始化數據庫
導入project-datamode文件夾下的zheng.sql
直接把sql文件拖入進去
導入成功
(二), 修改本地Host
進入到C:\Windows\System32\drivers\etc文件夾下,打開hosts文件
(三),啟動相關軟件
1.啟動Zoolkeeper,進入zookeeper的bin目錄,雙擊zkServer.cmd啟動服務
假如啟動閃退,解決辦法把zkEnv.exe以文本打開,添加自己的jdk路徑
2.啟動ActiveMQ
進入bin文件下(我的系統是64位進入win64),點擊activemq.bat 即可
在瀏覽器輸入http://localhost:8161/admin/ 默認密碼都是admin,出現官網界面說明啟動成功
3.啟動Ngins
在zheng/project-tools/nginx 下提供了ngxin的一些配置
將這兩個文件復制到nginx/conf下
在nginx.bat文件夾下新建一個nginx.bat,添加以下內容:
@echo off rem zheng-tools rem author: shuzheng http://www.zhangshuzheng.cn rem GitHub: https://github.com/shuzheng rem OsChina: http://git.oschina.net/shuzheng/zhengecho ==================begin========================cls SET NGINX_PATH=F: SET NGINX_DIR=F:\ProjectStart\nginx-1.17.2\ color 0a TITLE zheng-tools Power By shuzheng (http://www.zhangshuzheng.cn)CLS ECHO. ECHO. ******************************************************************** ECHO. * * ECHO. * * ECHO. * zheng-tools Power By shuzheng (http://www.zhangshuzheng.cn) * ECHO. * * ECHO. * * ECHO. ******************************************************************** ECHO. :MENU ECHO.---------------------------- nginx 進程列表 -------------------------------- tasklist|findstr /i "nginx.exe" if ERRORLEVEL 1 (echo nginx未啟動) else (echo nginx已啟動) ECHO.----------------------------------------------------------------------------ECHO. ECHO. [1] 啟動Nginx ECHO. [2] 關閉Nginx ECHO. [3] 重啟Nginx ECHO. [4] 退 出 ECHO. ECHO.請輸入選擇項目的序號: set /p ID=IF "%id%"=="1" GOTO start IF "%id%"=="2" GOTO stop IF "%id%"=="3" GOTO restart IF "%id%"=="4" EXIT PAUSE :start call :startNginxECHO.============================================================================ECHO. ECHO. GOTO MENU:stop call :shutdownNginxECHO.============================================================================ECHO. ECHO. GOTO MENU :restart call :shutdownNginxcall :startNginxECHO.============================================================================ECHO. ECHO. GOTO MENU:shutdownNginxECHO. ECHO.關閉Nginx...... taskkill /F /IM nginx.exe > nulECHO.OK,關閉所有nginx 進程goto :eof:startNginxECHO. ECHO.啟動Nginx...... IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe"不存在 %NGINX_PATH% cd "%NGINX_DIR%" IF EXIST "%NGINX_DIR%nginx.exe" (echo "start '' nginx.exe"start "" nginx.exe)ECHO.OKgoto :eof修改nginx.conf
#user nobody; worker_processes 1;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {#監聽的端口號,配置這里訪問的時候瀏覽器里可以訪問http://localhost:1000/zheng-cms-web/測試是否能看到頁面內容(沒有直接訪問http://localhost:1000,因為這個路徑zheng-ui下沒有index.html之類的文件,會出現訪問錯誤提示,不好作為判定是否nginx啟動配置成功的標志)listen 1000;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {#root后面內容需要修改為本機的zheng-ui項目的絕對路徑位置root E:/Project_application/github/zheng/zheng-ui/;index index.html index.htm;add_header Access-Control-Allow-Origin *;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}}注意修改路徑,否則會啟動失敗
成功啟動運行效果如下:
4.啟動Tomcat
在tomcat中部署dubbo應用,我用的是dubbo-admin-2.5.4-for-JDK1.8-master(注意jdk1.8會啟動失敗,要下載部署好jdk1.8就好了)
下載鏈接:https://pan.baidu.com/s/1ow2h6dwaoYJ7nQjiHVh_dA 密碼:4hp3
直接把文件夾拷貝到webapps下
修改tomcat端口,在conf文件夾server.xml修改端口,以免發生端口沖突,我改成8090,然后點擊
starup.bat,在瀏覽器輸入http://localhost:8089/dubbo-admin-2.5.4/ 官網成功打開,說明部署成功。
5.啟動前要修改各模塊下profile的數據庫連接密碼
還有dao層的
這里密碼使用了ASE加密,我們首先要改成自己數據庫的密碼,我的mysql和redis都改成123456,根據自己的數據庫密碼修改相應的值,使用com.zheng.common.util.ASEUtil工具類修改
五, 啟動Web服務
啟動之前要把maven依賴包打包,在maven視圖點擊install
啟動zheng-upms-rpc-service
啟動成功
這里啟動失敗會有幾個原因,redis數據庫密碼沒有修改,zookeeper服務沒有啟動
在maven視圖下
輸入http://upms.zhangshuzheng.cn:1111/ 賬號密碼是admin/123456 啟動成功畫面
zheng-cms啟動
zheng-cms-admin:啟動ActiveMQ–》啟動zheng-rpc-service–》啟動zheng-cms-admin
zheng-cms-web:啟動nginx代理zheng-ui靜態資源,然后訪問:http://upms.zhangshuzheng.cn:1111
CMS首頁: http://cms.zhangshuzheng.cn:2224/
借鑒前輩的:http://blog.csdn.net/u011781521/article/details/79012311
總結
以上是生活随笔為你收集整理的新手学习开源项目zheng环境部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 活动目录的组策略
- 下一篇: qt 之 qml 类型 Binding