小编Cle*_*ves的帖子

如何在生产环境中运行spring boot可执行jar?

Spring boot的首选部署方法是通过一个包含tomcat的可执行jar文件.

它以简单的方式开始java -jar myapp.jar.

现在,我想将该jar部署到我在EC2上的linux服务器上,我是否遗漏了某些东西或者我是否真的需要创建一个init脚本来正确启动应用程序作为守护进程?

如果我java -jar在注销时简单地调用应用程序就死了.

我可以在屏幕或nohup中启动它,但这不是很优雅,我的服务器重启将迫使我登录并手动启动该过程.

那么,春季靴子的任务是否已经存在?

java linux spring spring-boot

93
推荐指数
3
解决办法
10万
查看次数

从Azure连接到Amazon RDS上的Postgres数据库的超时

在数据库连接闲置一段时间后,我的应用程序中出现以下异常:

... An I/O error occured while sending to the backend.; nested exception is org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.] with root cause

    java.net.SocketException: Operation timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
Run Code Online (Sandbox Code Playgroud)

在psql中发生同样的问题我没有连接到本地数据库的问题,所以我很确定问题出在RDS上.

psql=> select 'ok';
SSL SYSCALL error: Operation timed out
psql=> select 'ok';
SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Succeeded.
Run Code Online (Sandbox Code Playgroud)

我发现了另一个问题,这个问题表明可以改善这种情况的工作(超时现在需要更长时间),但没有解决它.

我正在使用Spring Boot with JDBC(tomcat连接池)和JDBCTemplate.

有解决方法还是修复?也许强制连接池测试和重新连接?我如何在这种环境下做到这一点?

编辑:这是我的连接字符串

jdbc:postgresql://myhost.c2estvxozjm3.eu-west-1.rds.amazonaws.com/dashboard?tcpKeepAlive=true
Run Code Online (Sandbox Code Playgroud)

解:

根据所选答案中的建议编辑RDS服务器端TCP_KeepAlive参数.我正在使用的参数是:

tcp_keepalives_count      5
tcp_keepalives_idle     200 …
Run Code Online (Sandbox Code Playgroud)

postgresql spring-jdbc amazon-rds spring-boot

17
推荐指数
1
解决办法
1万
查看次数

在Perl中有选择地拆分字符串

Perl新手.

我需要解析一个如下所示的报告:

2012-05-29@emaillocalpart@emaildomain@customerid@errormessage@messageid
Run Code Online (Sandbox Code Playgroud)

我用了:

my @fields = split(/@/, $line, 6);
Run Code Online (Sandbox Code Playgroud)

大部分时间它工作正常,但有时错误消息将包含一个电子邮件地址和该电子邮件上的@符号后面的所有文本,直到字符串的结尾将以我的消息ID结束.

我考虑过检查@s的数量并进行条件解析,但是有更好的方法吗?

编辑:

所需的输出是一个字符串列表,错误消息包含其中包含的内容(包括偶尔的电子邮件地址).

由于有其他应用程序使用相同的报告,我无法更改分隔符或转义输出.

报告中的示例行:

2012-05-29@joedoe@example.com@AB99-5@440 4.4.1 Some error occurred@XYZ35
2012-05-29@foobar@invalid.com@ZZ88-6@550 5.1.1 <foobar@invalid.com>... User Unknow@GGH93
2012-05-29@barfoo@invalid.com@YY88-0@550 5.1.1 barfoo@invalid.com no such user@GGH93
Run Code Online (Sandbox Code Playgroud)

解析第1行后@fields的预期内容:

2012-05-29
joedoe
example.com
AB99-5
440 4.4.1 Some error occurred
XYZ35
Run Code Online (Sandbox Code Playgroud)

解析第2行之后:

2012-05-29
foobar
invalid.com
ZZ88-6
550 5.1.1 <foobar@invalid.com>... User Unknow
GGH93
Run Code Online (Sandbox Code Playgroud)

regex perl parsing split

6
推荐指数
1
解决办法
401
查看次数

使用git推送标签被拒绝为非快进

Git pull works不显示任何更新:

sh-3.2$ git pull
Already up-to-date.
Run Code Online (Sandbox Code Playgroud)

当我做一个git push我得到一个错误:

sh-3.2$ git push --tags
To user@example.com:some/git/repo
 ! [rejected]        DEVEL_BLEEDINGEDGE -> DEVEL_BLEEDINGEDGE (non-fast-forward)
error: failed to push some refs to 'user@example.com:some/git/repo'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)

重新赋予相同:

sh-3.2$ git pull --rebase
Current branch devel is up to date.
Run Code Online (Sandbox Code Playgroud)

DEVEL_BLEEDINGEDGE标记用于我的每日自动构建脚本,每次我需要使用这些脚本部署一些新东西时我移动该标记:

git tag -f DEVEL_BLEEDINGEDGE
Run Code Online (Sandbox Code Playgroud)

那么,为什么我不能把我的标签推回去? …

git

5
推荐指数
1
解决办法
4180
查看次数

标签 统计

spring-boot ×2

amazon-rds ×1

git ×1

java ×1

linux ×1

parsing ×1

perl ×1

postgresql ×1

regex ×1

split ×1

spring ×1

spring-jdbc ×1