我的想法是人们使用Docker来确保本地环境与生产相同,并且他们可以停止考虑他们的应用程序在物理上运行的位置,并且平衡机制应该只在那个时刻在最佳位置分配应用程序.
我是100%基于Web的,我将与我们的数据库一起迁移到云,并且无法移动的内容将无缝桥接,因此企业的东西和云将成为一个子网.
所以我想知道,也许Service Fabric已经做了与Docker相同的事情,加上它提供了地址转换服务(fabric://对于结构空间中的进程有点像DNS)加上(对一些人很重要)鼓励按需工作人员分配 - 巨大的可扩展性特权.
我有一个Java类,这是一个例子:
public class Car {
private int fuelType;
private Date made;
private String name;
.
.
. // and so on
Run Code Online (Sandbox Code Playgroud)
现在让我们说我有两个车对象,我想比较它们的所有变量是否相等.
现在,我通过重写方法解决了这个问题,equals(Object o)
并检查两个对象中的所有变量是否匹配.
这里的问题是,如果我有20个类,我将不得不覆盖它们equals(Object o)
中的每一个.
有没有办法创建某种通用方法,可以比较我传递给它的两个对象中的任何一个,并让我知道它们是否匹配每个变量?
我根据Ubuntu制作了一个发送应用程序的图像,然后安装tcpdump
.当我使用--privileged
并尝试启动容器时tcpdump -i eth0
,它报告错误:
root@test:/home/test# docker run --rm -ti --privileged mytliulei/xfdsend /bin/bash
root@6199493fb2b9:/# tcpdump -i eth0
tcpdump: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: Permission denied
Run Code Online (Sandbox Code Playgroud)
但是当我没有启动Docker容器时--privileged
,它没问题.为什么?
root@test:/home/test# docker run --rm -ti mytliulei/xfdsend /bin/bash
root@c7b7e2a9ec99:/# tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
Run Code Online (Sandbox Code Playgroud)
Docker版本:
docker version
Client version: 1.6.0
Client API …
Run Code Online (Sandbox Code Playgroud) 问题:是否可以将 Nginx 设置为数据库的反向代理?这些是我目前拥有的标志,我相信拥有该--with-stream
模块足以将 TCP 流用于数据库。这是 PLUS 功能吗?
Nginx 配置选项:
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=%{_libdir}/nginx/modules --conf-path=/etc/nginx/nginx.conf -- error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --锁路径=/var/run/nginx。lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/ var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx -- group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module -- with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module -- with-file-aio --with-http_v2_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,--as-needed ' --with-ipv6
Nginx 配置
stream {
include conf.d/streams/*.conf;
}
Run Code Online (Sandbox Code Playgroud)
的内容 conf.d/streams/upstream.conf
upstream database_server {
least_conn;
keepalive 512;
server 192.168.99.103:32778 max_fails=5 …
Run Code Online (Sandbox Code Playgroud) 我正在使用Sikuli IDE.我想知道截图的命令是什么,所以我可以在测试结束时捕获屏幕.
像这样的东西
try :
if bla bla bla:
print("blablabla")
else:
TAKESCREENSHOT() #------------------> What command do I put here?
print("TEST_FAILED")
Run Code Online (Sandbox Code Playgroud) 我试图在我的spring应用程序中集成Quartz作业.我从这里得到了这个例子.该示例显示了使用a simpletrigger
和在特定时间使用a 以重复间隔执行的作业crontrigger
.
我的要求是在应用程序启动时只运行一次作业.我删除了属性repeatInterval
,但应用程序抛出异常:
org.quartz.SchedulerException: Repeat Interval cannot be zero
Run Code Online (Sandbox Code Playgroud)
有没有办法安排一次工作?
谢谢..
这应该是非常直接的,但我看不到任何工作被执行.我在任务的execute()方法上有一个断点,没有任何线程到达那里.我没有弄到什么问题.
工作
class Printer implements Job{
public Printer(){
System.out.println("created printer");
}
@Override
public void execute(JobExecutionContext context)
throws JobExecutionException {
System.out.println("hi" + context.getFireTime());
}
}
Run Code Online (Sandbox Code Playgroud)
主要课程
class MyClass {
public static void main(String[] args) throws Throwable {
Scheduler s = StdSchedulerFactory.getDefaultScheduler();
JobDetail job = newJob(Printer.class).build();
CronTrigger trigger =
newTrigger()
.withIdentity("a", "t")
.withSchedule(cronSchedule("0/5 * * * * ?").inTimeZone(TimeZone.getDefault()))
.forJob(job).build();
s.scheduleJob(job, trigger);
// This prints the right date!
System.out.println(trigger.getNextFireTime());
s.start();
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:我发现我没有quartz.property文件,所以有可能没有创建石英线程池.因此,正如文档中所读,我使用StdSchedulerFactory替换了以下代码:
DirectSchedulerFactory.getInstance().createVolatileScheduler(10);
Scheduler s = DirectSchedulerFactory.getInstance().getScheduler();
Run Code Online (Sandbox Code Playgroud)
你猜怎么着?还没有运气.同样的效果.应用程序保持活着,触发不触发.
我想保留由Quartz调度程序安排的作业历史,其中包含以下属性:"开始时间","结束时间","成功","错误".
有两个可用的接口:ITriggerListener
和IJobListener
(我正在使用接口的C#命名约定,因为我使用的是Quartz.NET,但可能会要求Java版本提出相同的问题).
IJobListener
有JobToBeExecuted
一个JobWasExecuted
方法.后者提供了一个JobExecutionException
让你知道什么时候出错的地方.但是,没有办法关联JobToBeExecuted
和JobWasExecuted
.假设我的工作运行了十分钟.我在启动t0
和t0+2
(让他们重叠).我接到两个电话,JobToBeExecuted
并在历史表中插入两个开始时间.当两个工作完成时t1
,t1+2
我接到两个电话JobWasExecuted
.我如何知道每次调用中要更新的数据库记录(存储结束时间及其相应的开始时间)?
ITriggerListener
有另一个问题.TriggerComplete
当作业失败时,无法在方法内部获得任何错误.
我如何获得所需的行为?
这是我的XSD文件的一个简单的摘录
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="ns"
xmlns:tns="sns" elementFormDefault="qualified">
<element name="document">
<attribute name="title" use="required"/>
</element>
</schema>
Run Code Online (Sandbox Code Playgroud)
我用它maven-jaxb2-plugin
来生成Java类.本Document
类有一个getTitle()
返回的文本方法title
属性.
我想添加一个额外的方法Document
:
public String getStrippedTitle() {
return getTitle().replaceAll("\\s+", "");
}
Run Code Online (Sandbox Code Playgroud)
我希望我的额外方法出现在unmarshalled对象上(而不是我只是调用它或编写一个包装类)因为我想将顶级unmarshalled对象传递给一个字符串模板并让它迭代调用我的子元素额外的方法.
我找到了说明,但是他们告诉我设置一个属性,Unmarshaller
而我的(Mac OS X,Java 7)实现似乎不支持任何属性.
我该怎么做?
我目前正在使用shutil.copy2()
复制大量图像文件和文件夹(0.5到5演出之间的任何地方). Shutil
工作正常,但它太慢了.我想知道是否有办法将此信息传递给Windows以制作副本并给我标准的传输对话框.你知道,这家伙......
很多时候,我的脚本将占用标准Windows副本所花费的时间的两倍,这让我感到紧张,因为我的python解释器在运行副本时会挂起.我多次运行复制过程,我希望减少时间.