Nginx初始【一】

Nginx 变量

http://nginx.org/en/docs/varindex.html

Note

nginx关闭.bat
1
2
3
4
@REM nginx命令:正常停止或关闭。即处理完所有请求后再停止服务
nginx -s quit
@REM cmd命令:根据程序名来关闭进程。这里强制关闭nginx.exe,防止上一步未停止nginx。注:这个命令会杀掉所有正在运行的nginx
taskkill /f /t /im nginx.exe
nginx启动.bat
1
start nginx
nginx重启.bat
1
2
3
4
5
6
nginx -s reload
nginx -s quit
taskkill /f /t /im nginx.exe
start nginx
nginx -V
cmd
nginx重载.bat
1
nginx -s reload

Nginx服务配置为Windows系统服务

Nginx服务配置为Windows系统服务+日志处理

参考引用:

http://www.yaohaixiao.com/blog/how-to-configure-nginx-service-as-windows-system-service/
https://www.xilixili.net/2018/01/04/winsw-with-nginx/
https://github.com/winsw/winsw

winsw+nginx安装步骤

  1. 下载winsw.exe文件,重命名为nginx-service.exe
  2. 创建nginx-service.xml文件。
  3. 将nginx-service.exe和nginx-service.xml放在nginx.exe的同一目录下。
  4. 运行nginx-service.exe install nginx-service.xml安装服务;winsw install
  5. 运行nginx-service.exe start nginx-service.xml运行服务;winsw install
  6. 运行nginx-service.exe status nginx-service.xml查看服务状态;winsw status

CLI命令文档:https://github.com/winsw/winsw/blob/v3/docs/cli-commands.md#cli-commands
配置文件说明文档:https://github.com/winsw/winsw/blob/v3/docs/xml-config-file.md
配置文件示例:https://github.com/winsw/winsw/blob/v3/samples

运行目录:

1
2
3
4
5
6
7
E:nginx
│ nginx.exe
├─nginx-winsw
│ │ nginx-service.exe
│ │ nginx-service.xml
│ └─wswlogs
│ nginx-service.wrapper.log
  • 包装器及其子进程的默认工作目录是配置文件所在的目录。设置workingdirectory可以更改工作目录。
    • 未设置workingdirectory值的情况下,设置executable为E:\nginx\nginx.exe,默认执行路径为E:\nginx\nginx-winsw\nginx.exe
    • 设置workingdirectory值为E:\nginx,设置executable为E:\nginx\nginx.exe,执行路径为:E:\nginx\nginx.exe
  • 配置文件中,<logpath>日志文件夹的路径是相对于nginx-service.exe所在目录,它的根目录是nginx-service.exe所在目录。受限于nginx-service.exe所在目录。不受workingdirectory值影响。
  • 在未设置workingdirectory情况下,默认工作目录为nginx-service.exe所在目录,所以nginx-service.exe必须和nginx.exe在同一目录下才能成功启动。

sample.xml:

sample.xml
1
2
3
4
5
6
7
8
9
10
<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins continuous integration system.</description>
<env name="JENKINS_HOME" value="%BASE%"/>
<executable>java</executable>
<arguments>-Xrs -Xmx256m -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
<log mode="roll"></log>
</service>

nginx-service.xml:

nginx-service.xml
1
2
3
4
5
6
7
8
9
10
11
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx服务</description>
<logpath>./logs</logpath>
<logmode>roll</logmode>
<executable>nginx.exe</executable>
<stopexecutable>nginx.exe</stopexecutable>
<stopargument>-s</stopargument>
<stopargument>stop</stopargument>
</service>
自定义workingdirectory.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!--
MIT License

Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees,
Inc., Oleg Nenashev and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->

<!--
This is a sample configuration of the Windows Service Wrapper.
This configuration file should be placed near the WinSW executable, the name should be the same.
E.g. for myapp.exe the configuration file name should be myapp.xml

You can find more information about configuration options here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
-->
<service>

<!--
SECTION: Mandatory options
All options in other sections are optional
-->

<!-- ID of the service. It should be unique accross the Windows system-->
<id>nginxservice</id>
<!-- Display name of the service -->
<name>Nginx Service (powered by WinSW)</name>
<!-- Service description -->
<description>Nginx包装成Windows服务</description>

<!-- Path to the executable, which should be started -->
<executable>E:\nginx\nginx.exe</executable>

<!--
SECTION: Installation
These options are being used during the installation only.
Their modification will not take affect without the service re-installation.
-->

<!--
OPTION: serviceaccount
Defines account, under which the service should run.
-->
<!--
<serviceaccount>
<domain>YOURDOMAIN</domain>
<user>useraccount</user>
<password>Pa55w0rd</password>
<allowservicelogon>true</allowservicelogon>
</serviceaccount>
-->

<!--
OPTION: onfailure
Defines a sequence of actions, which should be performed if the managed executable fails.
Supported actions: restart, reboot, none
-->
<!--
<onfailure action="restart" delay="10 sec"/>
<onfailure action="restart" delay="20 sec"/>
<onfailure action="reboot" />
-->

<!--
OPTION: resetfailure
Time, after which the Windows service resets the failure status.
Default value: 1 day
-->
<!--
<resetfailure>1 hour</resetfailure>
-->

<!--
OPTION: securityDescriptor
The security descriptor string for the service in SDDL form.
For more information, see https://docs.microsoft.com/windows/win32/secauthz/security-descriptor-definition-language.
-->

<!--<securityDescriptor></securityDescriptor>-->

<!--
SECTION: Executable management
-->

<!--
OPTION: arguments
Arguments, which should be passed to the executable
-->
<!--
<arguments>-classpath c:\cygwin\home\kohsuke\ws\hello-world\out\production\hello-world test.Main</arguments>
-->

<!--
OPTION: startarguments
Arguments, which should be passed to the executable when it starts
If specified, overrides 'arguments'.
-->
<!--
<startarguments></startarguments>
-->

<!--
OPTION: workingdirectory
If specified, sets the default working directory of the executable
Default value: Directory of the service wrapper executable.
-->

<workingdirectory>E:\nginx</workingdirectory>


<!--
OPTION: priority
Desired process priority.
Possible values: Normal, Idle, High, RealTime, BelowNormal, AboveNormal
Default value: Normal
-->
<priority>Normal</priority>

<!--
OPTION: stoptimeout
Time to wait for the service to gracefully shutdown the executable before we forcibly kill it
Default value: 15 seconds
-->
<stoptimeout>15 sec</stoptimeout>

<!--
OPTION: stopparentprocessfirst
If set, WinSW will terminate the parent process before stopping the children.
Default value: true
-->
<stopparentprocessfirst>true</stopparentprocessfirst>


<!--
OPTION: stopexecutable
Path to an optional executable, which performs shutdown of the service.
This executable will be used if and only if 'stoparguments' are specified.
If 'stoparguments' are defined without this option, 'executable' will be used as a stop executable
-->

<stopexecutable>E:\nginx\nginx.exe</stopexecutable>


<!--
OPTION: stoparguments
Additional arguments, which should be passed to the stop executable during termination.
This OPTION also enables termination of the executable via stop executable
-->
<!-- 快速退出 -->
<stoparguments>-s stop</stoparguments>
<!-- 退出 -->
<!-- <stoparguments>-s quit</stoparguments> -->


<!--
SECTION: Service management
-->
<!--
OPTION: startmode
Defines start mode of the service.
Supported modes: Automatic, Manual, Boot, System (latter ones are supported for driver services only)
Default mode: Automatic
-->
<startmode>Automatic</startmode>

<!--
OPTION: delayedAutoStart
Enables the Delayed Automatic Start if 'Automatic' is specified in the 'startmode' field.
See the WinSW documentation to get info about supported platform versions and limitations.
-->
<!--<delayedAutoStart/>-->

<!--
OPTION: depend
Optionally specifies services that must start before this service starts.
-->
<!--
<depend>Eventlog</depend>
<depend>W32Time</depend>
-->

<!--
OPTION: waithint
The estimated time required for a pending stop operation.
Before the specified amount of time has elapsed, the service should make its next call to the SetServiceStatus function.
Otherwise the service will be marked as non-responding
Default value: 15 seconds
-->
<waithint>15 sec</waithint>

<!--
OPTION: sleeptime
The time before the service should make its next call to the SetServiceStatus function.
Do not wait longer than the wait hint. A good interval is one-tenth of the wait hint but not less than 1 second and not more than 10 seconds.
Default value: 1 second
-->
<sleeptime>1 sec</sleeptime>

<!--
OPTION: interactive
Indicates the service can interactwith the desktop.
-->
<!--
<interactive/>
-->

<!--
SECTION:Logging
-->

<!--
OPTION: logpath
Sets a custom logging directory for all logs being produced by the service wrapper
Default value: Directory, which contains the executor
-->

<logpath>./wswlogs</logpath>


<!--
OPTION: log
Defines logging mode for logs produced by the executable.
Supported modes:
* append - Rust update the existing log
* none - Do not save executable logs to the disk
* reset - Wipe the log files on startup
* roll - Roll logs based on size
* roll-by-time - Roll logs based on time
* rotate - Rotate logs based on size, (8 logs, 10MB each). This mode is deprecated, use "roll"
Default mode: append

Each mode has different settings.
See https://github.com/kohsuke/winsw/blob/master/doc/loggingAndErrorReporting.md for more details
-->
<log mode="roll-by-time">
<pattern>yyyyMMdd</pattern>
</log>

<!--
SECTION: Environment setup
-->
<!--
OPTION: env
Sets or overrides environment variables.
There may be multiple entries configured on the top level.
-->
<!--
<env name="MY_TOOL_HOME" value="C:\etc\tools\myTool" />
<env name="LM_LICENSE_FILE" value="host1;host2" />
-->


<!--
OPTION: download
List of downloads to be performed by the wrapper before starting
-->
<!--
<download from="http://www.google.com/" to="%BASE%\index.html" />

Download and fail the service startup on Error:
<download from="http://www.nosuchhostexists.com/" to="%BASE%\dummy.html" failOnError="true"/>

An example for unsecure Basic authentication because the connection is not encrypted:
<download from="http://example.com/some.dat" to="%BASE%\some.dat"
auth="basic" unsecureAuth=“true”
username="aUser" password=“aPassw0rd" />

Secure Basic authentication via HTTPS:
<download from="https://example.com/some.dat" to="%BASE%\some.dat"
auth="basic" username="aUser" password="aPassw0rd" />

Secure authentication when the target server and the client are members of the same domain or
the server domain and the client domain belong to the same forest with a trust:
<download from="https://example.com/some.dat" to="%BASE%\some.dat" auth="sspi" />
-->

<!--
SECTION: Other options
-->

<!--
OPTION: beeponshutdown
Indicates the service should beep when finished on shutdown (if it's supported by OS).
-->
<!--
<beeponshutdown/>
-->

<!--
SECTION: Extensions
This configuration section allows specifying custom extensions.
More info is available here: https://github.com/kohsuke/winsw/blob/master/doc/extensions/extensions.md
-->

<!--
<extensions>
Extension 1: id values must be unique
<extension enabled="true" id="extension1" className="winsw.Plugins.SharedDirectoryMapper.SharedDirectoryMapper">
<mapping>
<map enabled="false" label="N:" uncpath="\\UNC"/>
<map enabled="false" label="M:" uncpath="\\UNC2"/>
</mapping>
</extension>
...
</extensions>
-->

</service>

nginx-service.exe 和nginx-service.xml文件路径:

tree.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
D:nginx
nginx-service.exe
nginx-service.xml
nginx.exe

├─conf

├─contrib

├─docs

├─html

├─logs

└─temp

widows 命令:

echo.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@ECHO OFF
REM 声明采用UTF-8编码
chcp 65001
@REM 启动
echo 启动 nginx-service.exe start

@REM 停止
echo 停止 nginx-service.exe stop

@REM 安装
echo 安装 nginx-service.exe install

@REM 卸载
echo 卸载 nginx-service.exe uninstall

pause

Nginx日志处理

思路

nginx -s reopen命令控制Nginx重新打开日志文件(生成文件)的,通过WinSW封装一个reopen的操作的服务(可以保证SYSTEM权限),剩下的就是定时任务了(注意运行账户改为SYSTEM)。

Nginx Logrote Service 批处理文件样例

logservice.xml
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="UTF-8" ?>
<service>
<id>nginx-logrote</id>
<name>Nginx Logrote Service</name>
<description>基于Nginx的媒体流服务器的Logrote服务</description>
<executable>cleanlog.bat</executable>
<startmode>Manual</startmode>
<logpath>./logs</logpath>
<logmode>roll</logmode>
</service>
cleanlog.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@ECHO OFF
CD logs

FOR /f "delims=" %%i IN ('DIR /a-d /b access.log') DO (
IF %%~zi gtr 10485760 (
MOVE /Y %%i %%i.bak
)
)

FOR /f "delims=" %%i IN ('DIR /a-d /b error.log') DO (
IF %%~zi gtr 10485760 (
MOVE /Y %%i %%i.bak
)
)

CD ..
nginx -s reopen

快捷bat

卸载重装wsw
1
2
3
nginx-service.exe uninstall nginx-service.xml
nginx-service install nginx-service.xml
pause
开启wsw服务
1
2
nginx-service start nginx-service.xml
nginx-service status nginx-service.xml
停止wsw服务
1
nginx-service stop nginx-service.xml

Nginx代理Oracle数据库连接

开始

使用本地1500端口反向代理 10.120.1.78:9800 得Oracle连接。

nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# stream 代理,代理oracle连接
stream {
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

access_log logs/tcp-access.log proxy ;
error_log logs/tcp_error.log;

upstream oracle{
server 10.120.1.78:9800 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 1500 so_keepalive=on; #so_keepalive,会话保持,防止查询飘走;
proxy_connect_timeout 3600s; #设置那么大,是为了防止动不动就断开连接
proxy_timeout 3600s;
proxy_pass oracle;
}
}

Nginx代理WebService

Nginx代理WebService

webservice 为IP地址

使用本地8091端口代理http://110.10.110.17:4658/calculator.asmx?wsdl 服务

nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
http{
upstream router {
server 110.10.110.17:4658 weight=1;
}
server {
listen 8091;
server_name localhost;
charset utf-8;

proxy_intercept_errors on;
location / {
proxy_pass http://router;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Via "nginx";
proxy_read_timeout 660;
proxy_connect_timeout 10;
proxy_send_timeout 60;
}

#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;
}
}
}

域名Webservice

Nginx代理的Webservice如果是域名访问路径,需要根据被代理WebService实际的Host请求头值来配置数据
使用本地8091端口代理http://www.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl服务

domain_webservice_nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
http{
#其它配置相同...
server {
#......
location / {
proxy_pass http://www.webxml.com.cn;
proxy_set_header Host $proxy_host:$proxy_port;
#其它配置相同...
}
#......
}
}

重点关注几个配置项:

  • upstream:用于配置 nginx 后端服务器(即 upstream,上游服务器),这里我们配置了两个后端服务器,并设置转发的权重分别为 2 和 1
  • proxy_pass:配置代码转发,即使用上面 upstream router 作为后端服务器转发
  • proxy_read_timeout:nginx 与后端服务器连接成功后,后端服务器响应的超时时间,即后端服务器处理请求的超时时间,由于后端服务器处理请求的最长时间为 600 秒,这里设置 660 秒
  • proxy_connect_timeout:nginx 与后端服务器连接的超时时间
  • proxy_send_timeout:后端服务器完成请求处理后,传输完整数据的超时时间
    先启动两个后端服务器,这两个后端服务器均对处提供 WebService 接口。然后使用 docker-compose up -d 启动 nginx 作为 WebService 接口反向代理。

客户端访问 nginx ,可以看到客户端 WebService 请求被正常转发到了两个 WebService 后端服务器处理,然后客户端通过 nginx 正常获取了后端服务器的返回结果。


原文链接:https://blog.csdn.net/lihao21/article/details/110856326

vim常用命令快捷键

操作和重复操作

命令 操作
a 在当前光标位置后追加文本
:w 保存
:wq 保存并退出
:q 退出
:q! 强制退出,放弃改动
:set nu 显示行号
:set nonu 不显示行号
d 高级删除指令:
dw :删除一个单词
df :配合 f ,删除从光标处到 ( 的字符,单行操作
dd :删除当前行
d2w :删除两个单词
d2t :删除当前位置到后面第二个 , 之间的内容,不包含 , (t = to)
v 选择模式,用上下左右选择文本,按相应的指令直接执行,如:选中后执行 d 就直接删除选中的文本

基础编辑,移动光标

命令 操作
$ 行尾
^ 行首
w 下一个单词 (词首)
e 下一个单词(词尾)
b 前一个单词
x del 删除后一个字符
X backspace 删除前一个字符
u 撤销
ctrl+r 重做
k
h
g
l
i 插入,开始写东西
s 覆盖
esc 退出输入模式,进入普通模式,可执行各种命令

搜索

命令 操作
/ 从当前位置向后搜索
从当前位置后前搜索
n 搜索完之后,如果有多个结果,跳到 下一个匹 配项
N 跳到 上一个 匹配项
* 直接匹配当前光标下面的字符串,移到下一个匹配项,跟/ ? 没有关系
# 上一个匹配项

Linux工具记录

前言

记录下在Linux系上常用的一些软件,工具。

软件

软件名称 运行环境 用途 备注 地址
GNOME Linux系 系统GUI 官网:GNOME
VNC-View Windows/Linux… 远程控制工具软件 VNC® Viewer VNC® Server
WinSCP Windows 在本地与远程计算机间安全的复制文件 是一个流行的 SFTP 客户端和 Microsoft Windows 的 FTP 客户端!使用在本地计算机和远程服务器之间复制文件FTP、FTPS、SCP、SFTP、WebDAV 或 S3 文件传输协议 WinSCP Download

命令

code 用途 备注
$PWD 当前工作路径 在Linux系统中,pwd命令用作显示工作目录的路径名称,全称是“Print Working Directory”

文件目录操作命令

code 用途 备注
mkdir testfolder 创建一个文件夹 如果不能删除或者建立的话,可以使用sudo命令,如 sudo rm -rf 文件夹名称,也可先su root,拥有root权限再操作。
rmdir testfolder 删除一个空文件夹
rm a.txt b.txt 删除一个文件或多个文件
rm -rf test2 删除一个非空文件夹下的一切

kettle填坑【二】

运行环境:

  • Kettle Version 9.2
  • sqljdbc_6.0.8112.200
  • java version “1.8.0_301”
  • MS Sql Server2016 已开启强制加密[Configuration Manager->SQL server 网络配置->MSSQLSERVER的协议->右键点击属性->Force Encryption]

ktr文件中的连接配置:

MSSQL类型
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<connection>
<name>测试数据库</name>
<server>192.168.1.1</server>
<type>MSSQL</type>
<access>Native</access>
<database>test</database>
<port>1433</port>
<username>sa</username>
<password>xxxxxxxxx</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>xxxxxx...</attributes>
</connection>
MSSQL(NATIVE)类型
1
2
3
4
5
6
7
8
9
10
11
12
13
<connection>
<name>test</name>
<server>${test.server}</server>
<type>MSSQLNATIVE</type>
<access>Native</access>
<database>${test.database}</database>
<port>1433</port>
<username>${test.username}</username>
<password>${test.pwd}</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
</connection>
Kettle/PDI使用MS Sql Server类型连接MS Sql Server失败

连接类型:MS Sql Server
连接方式:Native(JDBC)

具体报错:

Driver class ‘net.sourceforge.jtds.jdbc.Driver’ could not be found, make sure the ‘MS SQL Server’ driver (jar file) is installed.

解决方法:下载jtds.jar包,将文件移动到data-integration\lib 中,下载地址:jTDS - SQL Server and Sybase JDBC driver Files

Kettle/PDI使用MS Sql Server类型连接MS Sql Server失败,提示参数错误。

连接类型:MS Sql Server
连接方式:Native(JDBC)

具体报错:

Connection failed. Verify all connection parameters and confirm that the appropriate driver is installed.
I/O Error: DB server closed connection.

问题引起原因:Kettle连接数据库方法类型使用MSSQL是使用jtds连接数据库,但连接开启强制加密的数据库会提示参数缺失。

解决方法:
暂时还没找到,临时方法改用连接类型:MS Sql Server(Native) 连接方式:Native(JDBC)处理

Kettle/PDI使用MS Sql Server(Native)类型连接MS Sql Server失败,提示jar缺失

连接类型:MS Sql Server(Native)
连接方式:Native(JDBC)

具体报错:

Driver class ‘sun.jdbc.odbc.JdbcOdbcDriver’ could not be found, make sure the ‘MS SQL Server’ driver (jar file) is installed. sun.jdbc.odbc.JdbcOdbcDriver

解决方法:从此下列链接下载sqljdbc jar文件 将其放在 data-integration/lib 文件夹中

Download Microsoft JDBC Driver 6.0 for SQL Server (tar.gz)
JDBC历史版本

Kettle/PDI使用MS Sql Server(Native)类型连接MS Sql Server失败,提示无法建立安全连接

连接类型:MS Sql Server(Native)
连接方式:Native(JDBC)

具体报错:

com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client preferences [TLS12]”

问题引起的原因:从1.8_171开始,会禁用3DES加密
原文摘录:

3DES Cipher Suites Disabled

To improve the strength of SSL/TLS connections, 3DES cipher suites have been disabled in SSL/TLS connections in the JDK via the jdk.tls.>disabledAlgorithms Security Property.

解决方法:
修改%JAVA_HOME%/jre/lib/security/java.security文件中数据库加密方式,找到jdk.tls.disabledAlgorithms配置节点,将TLSv1、TLSv1.1、3DES_EDE_CBC从禁止名单中剔除。

E:\Java\jdk1.8\jre\lib\security\java.security
1
2
3
4
5
6
7
8
# 原配置 :
# jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
# DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
# include jdk.disabled.namedCurves
# 改动后配置:
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, anon, NULL, \
include jdk.disabled.namedCurves

参考:https://blog.csdn.net/chch87/article/details/86504581

书签摘录

https://www.staroon.dev/categories/Kettle/
https://inf.news/zh-hans/technique/549875ce18ea3b72c350f4449370c3ad.html
https://xiaoym.gitee.io/2019/08/08/kettle-2/#%E9%9C%80%E6%B1%82-2
https://ai.plainenglish.io/pentaho-data-integration-installation-guide-easy-yet-powerful-etl-tool-80930cff46c6
https://ai.plainenglish.io/getting-started-with-pentaho-data-integration-kettle-and-its-components-ef1e71101323
https://ai.plainenglish.io/what-is-the-pdi-client-spoon-in-pentaho-data-integration-kettle-df65b33879ac
https://medium.com/@shravankumar.suvarna
https://sourceforge.net/projects/pentaho/files/
https://mvnrepository.com/artifact/pentaho-kettle
https://stackoverflow.com/questions/11634181/pentaho-data-integration-sql-connection
https://help.hitachivantara.com/Documentation/Pentaho/9.2/Setup/JDBC_drivers_reference#r_pentaho_my_sql_jdbc_drivers_reference
https://jira.pentaho.com/browse/PDI-11536
https://jira.pentaho.com/projects/PDI/issues/PDI-16383?filter=allopenissues
https://sourceforge.net/projects/jtds/files/

SSL/TLS及证书概述【转】

SSL/TLS及证书概述

握手的交互图:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
+--------+                                      +--------+
| | 1. ClientHello | |
| |------------------------------------->| |
| | | |
| | 2. ServerHello | |
| | 3. Certificate | |
| | 4. ServerKeyExchange (optional) | |
| | 5. CertificateRequest (optional) | |
| | 6. ServerHelloDone | |
| |<------------------------------------ | |
| Client | | Server |
| | 7. Certificate (optional) | |
| | 8. ClientKeyExchange | |
| | 9. CertificateVerify (optional) | |
| | 10. Finished | |
| |------------------------------------> | |
| | | |
| | 11. Finished | |
| |<------------------------------------ | |
+--------+ +--------+

2022年3月6日

2022年3月6日早晨,外婆永远离我而去,听闻消息,心神恍惚,无法相信如此突然,高铁上想起,总是悔恨自己没能见上外婆最后一面,为什么不去看外婆,明明只需要3个小时不到,为什么这么抠门,自己真不是个东西。每每想起外婆,心中百般情绪无法平息,眼里总时会泛起泪水,都说人的一生需要童年去治愈,可自己的大半个童年的参与者突然离世,而我却没有见上最后一面,我一生都无法原谅自己。
外婆生于四十年代末,是当年上山下乡运动中的一员,从广东漂泊到江西的一个山沟沟,经历的苦难是现在的我无法想象。她和大多数书中描写的上山下乡运动中的人一样,是坚强勤劳的,可她的人生为何也如多数书中描述的一样,是充满苦难的一生。到底是因为勤劳而充满苦难,还是因为人生太多苦难而勤劳?我不知道,我也不可能得到答案了。在山沟沟里,外婆辛苦操劳一生,用自己的一双手将六个孩子拉扯长大,孩子都成家后还来带我们这些孙辈,个中辛苦已无处知晓。外婆用她的言传和身教教会了我很多东西,她的一生是勤俭节约的,有什么好吃的、好玩的都先留着,等我们去放假过节去玩就拿出来给我们吃,她自己却不吃或者吃一些边角料。如今外婆离去,世上再也没有谁会特意留着屋后板栗树上的板栗,只为了等我们去玩的时候拿出来给我们吃。再也没有人会特意将枇杷树下的草除掉,等我们放暑假来摘枇杷。再也没有了,没有了。
外婆是勤劳的人,她总是停不下自己的双手,孙辈也逐渐长大后,本是自己安享晚年,不用操劳的时候,她却担心儿女孙辈在外吃的不好,古稀之年一个人弄了个菜园,可最终却摔倒在了菜园。为了儿女孙辈她付出了太多,小的时候从书中读到无私奉献默默无闻时,只是纸上读来终觉浅,未曾真正理解这八个字,外婆的一生担得起这八个字,这八个字配的上外婆。
外婆勤劳的背后藏着太多的苦难,她也是外太公的女儿,也是手心上的宝贝,不是谁一生下来就是农民,当年的上山下乡让一名城市女性走向一名勤劳的农民,我无法想象其中之苦,可为何如此勤劳的人一生为何如此短暂,为何在人生的最后阶段也是痛苦的,我叹这世道太过无常,叹这人间疾苦。
纵使现在千丝万绪,已无力挽回。人生在世,多多陪伴家人。追悔莫及,我只恨自己,无法原谅自己。

VUE初识【二】

vue全局引入组件Vue.use()与Vue.component()的用法与区别

main.js全局引入组件的两种方式

1
2
3
4
5
6
7
// 1. Vue.use()
import Alert from '@/components/alert/index.js'
Vue.use(Alert)

// 2. Vue.component()
import Alert from "@/components/alert/src/main.vue"
Vue.component('alert', Alert)
  • ue.component()里面接收两个参数

    • 第一个参数是自定义元素名称,也就是将来在别的组件中使用这个组件的标签名称。
    • 第二个参数是将要注册的Vue组件。
  • Vue.use函数内部会调用参数的install方法,并且将Vue实例传入过去

Vue.use 和Vue.component 全局引入组件之间的区别:

  • Vue.component 只是单纯的引入组件、不需要额外写支持的js文件
  • Vuew.use 除组件外,需要写额外的js实现install方法,但它不仅可以注入组件,还可以注入很多其他东西,比如全局实例属性等。

参考:

https://juejin.cn/post/7021495820130353165
http://www.zuo11.com/blog/2020/7/vue_global_comps.html

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×