日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iBase4J部署总结

發(fā)布時間:2023/12/20 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iBase4J部署总结 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

iBase4J部署總結(jié)


序言

  • 最近看到個分布式框架,只有一個字:好。所以部署起來看看。開始的時候說實話遇到了點困難。去碼云上看了下,貌似想得到指導(dǎo)要加入一個群,而且需要收費的,反正閑來無事,索性自己搞好了。就當(dāng)學(xué)習(xí)了。這里把經(jīng)驗分享一下。希望作者看到不要生氣。我只是記錄下學(xué)習(xí)經(jīng)驗。

    啟動iBase4J前需要做一些準(zhǔn)備工作。如安裝zookeeper,啟動dubbo,配置nginx等。

    1 、準(zhǔn)備工作

  • 安裝虛擬機(有點窮,用不起阿里云)
    虛擬機我這里用的vmware workstation9,安裝挺簡單的,我這里就不贅述了。網(wǎng)上一搜一大片。
    下載地址:http://www.linuxidc.com/Linux/2012-11/73743.htm
  • linux安裝 centos 7。

    • 下載centos7鏡像 :
      下載地址
      :http://www.centoscn.com/CentosSoft/iso/2015/0402/5070.html

    • 查看網(wǎng)絡(luò)地址: centos7取消了ifconfig命令,使用ip addr命令查看IP地址,但是貌似ip addr和ifconfig都能用。前提是需要安裝ifconfig。
      如果遇到ifconfig command not found,解決方法:yum install net-tools.x86_64(安裝ifconfig)

    • 配置網(wǎng)絡(luò)

    • 找到以太網(wǎng)卡配置文件/etc/sysconfig/network-scripts/ifcfg-enp**文件,后面的數(shù)字好像是隨機生成的。

    • 使用Root打開并編輯些文件,將onboot的”no”改為“yes”,然后重啟網(wǎng)絡(luò)。

      最后輸入:wq 保存并退出,再重啟一下network:

    • 重啟網(wǎng)絡(luò)命令:# service network restart 這樣再啟動系統(tǒng)時,網(wǎng)絡(luò)也會自動啟動。

  • JDK安裝配置

    • vi /etc/profile
      export JAVA_HOME=/usr/local/jdk1.7.0
      export CLASSPATH=.:JAVAHOME/lib/tools.jar:JAVAHOME/lib/tools.jar:JAVA_HOME/lib/dt.jar
      export PATH=JAVAHOME/bin:JAVAHOME/bin:PATH
      使環(huán)境變量生效
      source /etc/profile
  • 安裝zookeeper

    • 下載zookeeper-3.4.6.tar.gz,
      下載地址:http://pan.baidu.com/s/1jIi9nUY

    • 解壓到/home/zookeeper/,解壓命令:tar –zxvf zookeeper-3.4.6.tar.gz ,重命名為zookeeper,重命名命令 :mv zookeeper-3.4.6.tar.gz zookeeper

    • 進入/home/zookeeper/zookeeper/conf下,復(fù)制zoo_sample.cfg, 命令為cp zoo_sample.cfg zoo.cfg,然后編輯zoo.cfg, 命令為:vi zoo.cfg。

      然后保存退出。
      ?tickTime:這個時間是作為Zookeeper 服務(wù)器之間或客戶端與服務(wù)器之間維持心跳的時間間隔,也就是每個 tickTime 時間就會發(fā)送一個心跳。
      ?dataDir:顧名思義就是 Zookeeper保存數(shù)據(jù)的目錄,默認(rèn)情況下,Zookeeper 將寫數(shù)據(jù)的日志文件也保存在這個目錄里。
      ?dataLogDir:顧名思義就是Zookeeper 保存日志文件的目錄
      ?clientPort:這個端口就是客戶端連接Zookeeper 服務(wù)器的端口,Zookeeper 會監(jiān)聽這個端口,接受客戶端的訪問請求

      從配置可以看出,需要到zookeeper根目錄下創(chuàng)建兩個文件夾data,logs。命令:mkdir data/mkdir logs。創(chuàng)建好之后進入data目錄。創(chuàng)建myid文件,命令:vi myid,編輯內(nèi)容:1。如圖:
      這里的1對應(yīng)zoo.cfg配置里的server.1=ip:2888:3888

    • 配置環(huán)境變量
      進入到/etc目錄下,編輯profile文件(配置環(huán)境變量)。命令:vi profile,如圖:

    • 然后編輯/etc/hosts進行路徑映射。vi hosts,本機編輯好如圖。

    • 接下來啟動zookeeper。進入到/home/zookeeper/zookeeper/bin ,啟動./zkServer.sh start
    • 啟動客戶端:./zkCli.sh,出現(xiàn)如下界面

      啟動成功。
  • Dubbo啟動

    • 下載dubbo-admin-2.5.3的war包
      下載地址:http://pan.baidu.com/s/1bpzIyvH
      將下載下來的文件解壓,找到war包直接放入到tomcat 6下webapps目錄,刪除ROOT下的所以文件。像部署正常項目一樣啟動,不再贅述。啟動好之后,訪問http://192.168.91.133:8080/。出現(xiàn)如下界面:
      。輸入賬號root,密碼root進入顯示如下界面:
  • 安裝redis

    • 下載:http://download.redis.io/releases/redis-3.0.1.tar.gz
      放到/home/redis目錄下解壓:tar -zxvf redis-3.0.1.tar.gz,重命名:mv redis-3.0.1 redis。進入到:/home/redis/redis/src
      Make
      Make install
      新建bin和conf目錄。
      mkdir –p /home/redis/redis/bin
      mkdir –p /home/redis/redis/conf
      移動/home/redis/redis/redis.conf到/home/redis/redis/conf下。移動/home/redis/redis/src下7個綠色文件到/home/redis/redis/bin下。
      進入到conf下,編輯redis.conf
      使用linux快捷鍵查找”:/”,文檔內(nèi)查找快捷鍵。
      daemonize no改為yes:以守護進程方式運行,即后臺運行,redis默認(rèn)啟動方式是占用操作界面的。
      dir ./改為 /home/redis/redis/data
      端口,log,data,pid都需要修改路徑。
      appendonly no改為yes:指定每次更新之后進行日志記錄
      bing ip:這里的ip是要連接的客戶端機器ip.如果ip為:00.00.00.00則不限制連接客戶端ip
      備機設(shè)置:1、修改備機redis.conf,找到# slaveof改為 slaveof 192.168.132.157 6379(主機地址,備機啟動,自動設(shè)置為備機)
      2、登陸備機客戶端(登陸某臺redis客戶端:redis-cli –h 192.168.132.157 –p 6380
      ),slaveof 192.168.132.157 6379(主機地址,備機啟動,不會自動設(shè)置為備機)
      將redis添加到開機自啟動:
      echo “/home/redis/redis/bin/redis-server /home/redis/redis/conf/redis.conf”>>/etc/rc.d/rc.local
      啟動redis:進入到bin目錄,./redis-server /…./conf/redis.conf
      redis連接客戶端:redisDesktopManager: 鏈接:http://pan.baidu.com/s/1geM41KR 密碼:73gr
  • nginx安裝(nginx說實話在linux下映射項目沒有成功,所以后來我直接配置到window下的。這里就當(dāng)做個筆記,學(xué)習(xí)一下。只懼參考價值,因為都差不多)

    • 安裝nginx之前,需要安裝幾個必備軟件。
      1、GCC編譯器:可用來編譯C語言程序。yum install –y gcc
      2、GCC是必需的編譯工具,還需要C++編譯器。yum install –y gcc-c++
      3、PCRE庫函數(shù)庫,支持正則表達(dá)式。yum install –y pcre pcre-devel
      4、Zlib庫,zlib庫用于對HTTP包的內(nèi)容做gzip格式壓縮。yum install –y zlib zlib-devel
      5、OpenSSL開發(fā)庫。yum install –y openssl openssl-devel

    • 下載nginx源碼包:http://nginx.org/en/download.html
      2、放到/home/nginx下,解壓tar –zxvf nginx-1.10.3.tar.gz,重命名mv nginx-1.10.3 nginx,進入nginx,./configure&&make&&make install
      3、編輯/usr/local/nginx/conf/nginx.conf

worker_processes 2;error_log /usr/local/nginx/logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;pid /usr/local/nginx/pid/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 /usr/local/nginx/logs/access.log main;sendfile on; #tcp_nopush on;#keepalive_timeout 0; keepalive_timeout 65;#gzip on;upstream proxy {server 192.168.132.157:8088 weight=1;server 192.168.132.158:8088 weight=1; }server {listen 80;server_name 192.168.132.157;charset utf8;#access_log logs/host.access.log main;location / {proxy_pass http://proxy;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;# root html;# index index.html index.htm;}#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; # } #}

}
以上為自己的簡單配置,很多都沒有配置,如動靜分離,數(shù)據(jù)壓縮等。

  • 啟動nginx,/usr/local/nginx/sbin/nginx –c /usr/local/nginx/conf/nginx.conf

2 、配置iBase4J

  • 從碼云上下載下來項目,導(dǎo)入到eclipse里面。配置iBase4J-Common下資源包里面的system.properties文件。直接上圖吧:
  • 啟動的條件是JDK必須是1.8,tomcat7。其他的我試了,不行。
  • 配置完成之后,直接用普通的啟動方式就可以。
  • nginx配置
  • 配置沒有問題,直接啟動就可以。啟動起來,直接訪問localhost應(yīng)該可以的。
  • 3、總結(jié)

    • 重要的還是準(zhǔn)備工作,項目并不難。這個項目很有學(xué)習(xí)價值。之前自己也高了個分布式框架,只用到了zookeeper,dubbo,本來也打算放到曬曬,但是看到這個框架之后就徹底放棄了,上傳到自己git上就行了,不曬了,有點丟人。。。。試試部署吧,不知道行不行,反正我是行,哈哈。。。開個玩笑。。。。。

    轉(zhuǎn)載于:https://www.cnblogs.com/jpfss/p/9182920.html

    總結(jié)

    以上是生活随笔為你收集整理的iBase4J部署总结的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。