9.3. Implement customer site private cloud deployment specification

After the project by testing the system, can be used for customer use, you must first install the deployment. Some projects need to deploy to the client's own servers go above; some need to be deployed within the customer network server, then you need to go to the customer site deployment.

For deployed separately to the customer's own project on the server, we summarize some of the common problems encountered in the deployment, organize, develop agreed norms some deployments implementation.

1. Preparations

1.1. Common software ready

Were deployed on the server, database and web server in addition to the installation, other aids are desirable, it is more convenient during operation.

Here are some software, the future will put enterprise network drive, or preparing a U-disk storage. Without the need to download every time.

  1. JDK-11.0.2_windows-x64_bin.exe. Java environment setup file. The current development of our server, use the version 11 (small version number does not affect). The server is now generally 64, is substantially free of the 32-bit. Some projects, clients may be using the Java version 8, at the time the client package can be put together to run Java environment inside the package. Now the official website to download JDK need to log in, the account can go online to find others to share.
  2. Apache-Tomcat-9.0.16.exe. web server installation. Currently our server is using Tomcat, version 9.0.16. Use this version installed on the client server. Net official download link: https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.16/bin/
  3. vcredist_x64.exe. When you install the MySQL database, the system prerequisites needed, otherwise the installation will be stuck not go. If the server can be connected to external networks, you do not need to prepare, it will be automatically downloaded during installation. If the internal network, not even outside the network, you need to prepare for this program in advance.
  4. MySQL 5.7 installation package. Database installation file. Can go to the official website to download the Community Edition (free version, pay attention to select version 5.7), URL: https://dev.mysql.com/downloads/installer/
  5. Chrome browser. On the Windows server server for web access with built-in IE, will frequent pop-up dialog will whitelist of URLs, very annoying. So browse web pages on the server, install an additional browser, it is very necessary.
  6. Notepad ++. Convenient text file operations. To modify the regular profile, if the open notebook, since the interface is not formatted, is easily dazzled. After using Notepad ++ open, there are color-coded, and is formatted very easy to find individual configuration items.
  7. Navicat for mysql. And new database query tool. MySQL WorkBench comes only import and export the database (after Ali cloud database export, import using Navicat, will complain, not imported into), can not create and query databases.

1.2. Project document preparation

Project to be deployed to the server, that is, after the package should publish the project, and database scripts ready.

  1. Project release package. Use development tools IDEA, packaged items.
  2. Database scripts. Ali cloud platform using DMS, the database export (including table structure and table data).
  3. Other programs. For example, there are some projects the client program, run the installation package or bag, packed and ready.

2. Install

2.1.Java installation environment

Double-click the exe to install, all default. Java environment package can be installed by default in the C drive.

2.2.Tomcat installation

Double-click the exe to install. As a server, no other function, we only need to select the smallest mode installation.

Note: the disc D is mounted in the path selection. So even after reinstall the system, it will not affect the configuration information site. Because the site configuration information in Tomcat's conf directory, so only then Tomca re t added to the system the service.

Port number are using the default 8080.

Select the directory of the Java environment installation package.

After the installation is complete, open the browser, enter the default address: http: // localhost: 8080, will see the default home page, indicating Tomcat installation was successful.

2.3.MySQL database installation

Double-click the MySQL installation file, follow the wizard to install. Need to place special attention, will be described in detail below.

2.3.1.MySQL server installation

在安装MySQL时,有多个模式。采用最小化原则,由于只需要作为服务器,所以只需要选择仅作为服务器即可。

默认会选择第一种模式,那样会安装很多不需要使用的组件和功能,没有必要。

下一步,看到MySQL Server需要安装Microsoft Visual C++ 2013 Redistributable Package(x64)。

选中列表项,之后,不要点击Next,因为安装会失败。要点击Execute执行按钮,会弹出安装提示。如果服务器可以连接外网,就会自动下载需要的安装包。

继续进行安装,选择单机独立模式。

选择仅作为服务器模式。默认会选择第一个开发者模式。也可以看到默认的端口号是3306。

下一步,设置账号密码。

注意:由于是企业内部部署,为了方便IT部门进行管理,也为了方便以后其他同事进行更新维护。要将数据库的账号密码,存放到桌面上。

在桌面上创建文本文件:MySQL数据库账号,记录root账号和密码。之后,再添加项目数据库的账号和密码后,也要记录到文件中。

 

之后,继续安装,直到完成。

2.3.2.WorkBench安装

WorkBench是MySQL自带的辅助工具,可以进行数据库的导入导出。个人感觉比Navicat好用,用Navicat导入阿里云的数据库脚本,会报错,无法导入到数据库,用自带的WorkBench就OK。

安装WorkBench。再次运行MySQL的安装包文件,看到MySQL的服务端已经安装成功。点击添加按钮,会弹出组件选择对话框。

展开applications,选择MySQL Workbench,展开到底,选择版本。向右的箭头变绿,可点击。点击后,添加到右边列表,安装即可。

下一步,看到要添加安装的组件workbench在列表中,但是status状态是安装失败,跟第一次安装server时一样。选中后,看下面的详细提示,是需要安装Microsoft Visual C++ 2015 Redistributable Package (x64)。

此时,点击Execute执行按钮,不要点击Next下一步按钮。

如果服务器可以连接外网,那么就会自动从网络下载安装包,弹出安装界面,选择下一步即可。

安装完毕后,可以看到Execute按钮消失,只有下一步按钮。继续下一步进行安装,直到完成。

安装成功后,会弹出Workbench的主界面。如果没有打开主界面,也可以在开始菜单中找到Workbench打开。

点击主界面中默认的本地实例:Local instance,会弹出密码输入框。输入root密码,即可进入Workbench管理主界面。后面进行使用说明。

2.4.其他软件安装

其他软件的安装比较简单,没有什么需要特别注意和说明的。

3.配置

3.1.服务器设置

3.1.1.我的电脑图标放到桌面

服务器上没有特殊的设置,只是为了方便,把我的电脑和控制面板,放到桌面上。在开始菜单中,打开控制面板,搜索“桌面图标”,如下图所示,打开“显示或隐藏桌面上的通用图标”。

勾上计算机、控制面板,点击确定即可。

3.1.2.防火墙设置

这个应该是在Tomcat和项目都配置好后,再进行设置的地方。如果通过IP地址加端口,站点在本机可以本地访问,但是同网络其他地方不能访问,那就需要检查一下防火墙是否屏蔽了端口。

可以先关闭防火墙,测试外网是否可以访问。如果关闭防火墙后,可以访问,那么就可以确定是防火墙屏蔽了端口。

3.2.Tomcat配置

一般部署到企业内部服务器上的项目,都会使用局域网的IP地址进行访问,而不会绑定域名访问。一个IP地址加一个端口,就对应一个服务站点。Tomcat默认的端口是8080,使用IP地址+8080端口(http://IP地址:8080),即可访问项目。

但是这样会出现一个问题,就是一个Tomcat只能创建一个站点。如果要部署多个站点,则需要安装多个Tomcat,每个Tomcat使用不同的端口号。从而不同的站点就使用IP地址加各个端口号进行访问。

3.2.1.单web站点配置

如果只需要部署一个站点,那么在Tomcat安装成功后,输入地址:,会看到首页面,说明安装成功。

更改Tomcat默认的应用目录,到项目的文件夹。

3.2.2.多web站点配置

 

3.2.3.单站点多应用配置

 

3.3.数据库配置

3.3.1.创建数据库

MySQL安装成功后,

3.3.2.导入数据库表

3.3.3.修改数据库存放路径

要修改MySQL的一些参数和配置项,可以通过workbench进行设置,但是那样修改只会使当前的实例生效,实例重启后就失效了。要想是设置项永久生效,就必须要修改MySQL的配置文件my.ini。

MySQL默认安装在C盘。my.ini文件,在以前的低版本中,会直接存放在MySQL的安装目录中。现在的版本,都存放在C:\ProgramData\MySQL\MySQL Server 5.7目录中。也可以在C盘,直接搜索my.ini文件,如下图所示。

打开my.ini文件,找到datadir配置项。可以看到默认的设置值是:C:\ProgramData\MySQL\MySQL Server 5.7。修改设置值为:D:/MySQL/data。

同时,在D盘建立目录,并且将C:\ProgramData\MySQL\MySQL Server 5.7下的所有文件,都拷贝到D:/MySQL/data中。

3.3.4.修改时区

MySQL要修改下时区,否则项目在连接数据库时,有可能会报错,连接不上。而连接不上,开发人员很容易会以为是账号密码错误,要看Tomcat的日志,才会发现是时区的问题。

打开my.ini文件,增加default-time-zone选项。如下图所示。之前重启MySQL。

执行查询:show variables like '%time_zone%',时区已修改为+8:00了。

3.3.5.修改默认编码

首先查一下数据库的默认编码。

打开Workbench,在Query查询窗口,输入:show variables like '%character%',如下图所示。可以看到数据库的编码是latin1。

将character-set-server和default-character-set的注释去掉,设置值为utf8mb4。

修改后,重启MySQL,再次查询编码是否修改成功。如下图所示,以及修改成功。

3.1.项目配置

3.1.1.项目上传

首先将项目相关文件,上传到服务器上。一般我们会将文件,存放到D盘(除非没有D盘)。根据项目,创建文件夹。

 

3.1.2.修改项目数据库连接

部署在Tomcat上的web项目,需要修改项目的数据库连接地址。如下图所示,用Notepad++打开项目,WEB-INF目录classes文件夹下的dbconn.properties文件。修改4个db参数,注意第4个dbDebug设置为0。

3.2.2.客户端预制下载

如果项目有客户端程序,那么客户端应该是运行在用户端,而不是服务端。所以客户端需要在用户电脑上安装,或者在产线工位电脑上用于展示。

为了方便更新和安装,可以将客户端的安装包,放置在web项目的目录下,这样输入网址可以下载,方便在客户端上安装。

  • 特别是针对一些大企业,内部IT管理严格。想要安装和用U盘拷贝文件,都限制的严格,从web项目上下载会更加方便。
  • 而且现在产线上用于展示的电脑,都采用小的主机盒子,会固定在墙上或者天花板,想要插U盘,也比较麻烦。

3.2.3.客户端项目配置账号

如果客户端是用于展示功能,那么一般我们会通过账号来控制展示内容。如果有自启动或者自动登录,也需要先配置服务器路径和登录账号。

在客户端安装完毕后,需要将客户端的服务器路径和登录账号配置好。

4.更新项目

4.1.上传

首先将需要更新的文件,上传或者拷贝到服务器上。由于更新是经常性的操作,所以在服务器上建立好文件夹,安装日期将每次更新的文件,存放到相应的日期目录。

 

4.2.备份

更新操作不同于第一次安装部署,因为更新时,项目已经运行过,已经有了真实数据。所以不能贸然进行更新,一定要先进行备份。

4.3.更新

项目更新

数据库更新

客户端更新

发布了89 篇原创文章 · 获赞 71 · 访问量 14万+

Guess you like

Origin blog.csdn.net/weixin_42127613/article/details/102638576