首页 \ 问答 \ 重启后的Ulimit chnage没有效果(Ulimit chnage after reboot as no effect)

重启后的Ulimit chnage没有效果(Ulimit chnage after reboot as no effect)

我已经更改了/etc/security/limits.com并远程重启了计算机。但是,在启动之后, nproc参数仍然是旧值。

[ost@compute-0-1 ~]$ cat /etc/security/limits.conf
*   -   memlock     -1
*   -   stack       -1
*   -   nofile      4096
*   -   nproc       4096        <=====================================
[ost@compute-0-1 ~]$
Broadcast message from root@compute-0-1.local
    (/dev/pts/0) at 19:27 ...

The system is going down for reboot NOW!
Connection to compute-0-1 closed by remote host.
Connection to compute-0-1 closed.
ost@cluster:~$ ssh compute-0-1
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Last login: Tue Sep 27 19:25:25 2016 from cluster.local
Rocks Compute Node
Rocks 6.1 (Emerald Boa)
Profile built 19:00 23-Aug-2016

Kickstarted 19:08 23-Aug-2016
[ost@compute-0-1 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 516294
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024     <=========================
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

请注意我将max user processes设置为4096,但重启后,该值仍为1024。


I have changed /etc/security/limits.com and rebooted the machine remotely, However, after the boot, the nproc parameter has still the old value.

[ost@compute-0-1 ~]$ cat /etc/security/limits.conf
*   -   memlock     -1
*   -   stack       -1
*   -   nofile      4096
*   -   nproc       4096        <=====================================
[ost@compute-0-1 ~]$
Broadcast message from root@compute-0-1.local
    (/dev/pts/0) at 19:27 ...

The system is going down for reboot NOW!
Connection to compute-0-1 closed by remote host.
Connection to compute-0-1 closed.
ost@cluster:~$ ssh compute-0-1
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Last login: Tue Sep 27 19:25:25 2016 from cluster.local
Rocks Compute Node
Rocks 6.1 (Emerald Boa)
Profile built 19:00 23-Aug-2016

Kickstarted 19:08 23-Aug-2016
[ost@compute-0-1 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 516294
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024     <=========================
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Please see that I set max user processes to 4096 but after the reboot, the value is still 1024.


原文:https://stackoverflow.com/questions/39729510
更新时间:2022-06-28 19:06

最满意答案

我找到了解决方案。 我必须使用属性contentUsing而不是像这样在注释中using

@JsonSerialize(contentUsing = JsonDateSerializer.class)

contentUsing属性用于集合。 从课堂文档:

序列化器类,用于序列化注释属性的内容(集合/数组的元素,地图值)。 只能用于属性(方法,字段,构造函数),而不能用于类本身(因为它们通常是通用的)。


I found the solution. I had to use property contentUsing instead of using in annotation like this:

@JsonSerialize(contentUsing = JsonDateSerializer.class)

contentUsing property is used for collections. From class documentation:

Serializer class to use for serializing contents (elements of a Collection/array, values of Maps) of annotated property. Can only be used on properties (methods, fields, constructors), and not value classes themselves (as they are typically generic).

相关问答

更多
  • 如果您不想更改POJO类的合约,请考虑定义分别扩展JsonSerializer 和JsonDeserializer 的自定义Jackson序列化器/解串器的可能性。 例如: public class CountryDeserializer extends JsonDeserializer { @Override public CountryCode deserialize(final JsonParser jp, final Deserializa ...
  • 我终于找到了解决方案! 感谢indybee给我一个线索。 Spring 3.1,Hibernate 4和Jackson-Module-Hibernate教程为Spring 3.1和更早版本提供了一个很好的解决方案。 但是自3.1.2版本以来,Spring有自己的MappingJackson2HttpMessageConverter,与教程中的功能几乎相同,所以我们不需要创建这个自定义的HTTPMessageConverter。 使用javaconfig,我们不需要创建一个HibernateAwareObje ...
  • 你有不正确的日期时间模式。 该模式应该是yyyyMM dd hhmmss。 'D'代表每年的Day,'d'代表每月的Day。 You have the incorrect datetime pattern. The pattern should be yyyyMMdd hhmmss. 'D' for Day in year and 'd' for Day in month.
  • 我很确定你实际上并没有使用Jackson(JSON序列化的“POJO”变体),因为Jackson不会将单元素数组或列表转换为其他任何东西。 所以你可能正在使用一种传统的输出方法(如jettison); 这意味着如果您将系统配置为使用POJO映射,它应该可以正常工作。 I am pretty sure that you are not actually using Jackson ("POJO" variant of JSON serialization), since Jackson would not c ...
  • Json将map的键作为String处理,并且它的默认实现只是调用它的toString方法。 以下文章有清楚的解释,这可能会帮助你。 使用JSON时,我们可以使对象成为地图中的关键字吗? Json treats map's key as String and it default implementation simply calls its toString method. The following post has clear explanantion, this might help you. Ca ...
  • 我认为你应该使UserInfo静态。 杰克逊不能构建UserInfo类。 我尝试过这种改变,它适用于我: public class User { private List userInfoList; public static class UserInfo { private String id; public UserInfo() { super(); } public St ...
  • 我找到了解决方案。 我必须使用属性contentUsing而不是像这样在注释中using : @JsonSerialize(contentUsing = JsonDateSerializer.class) contentUsing属性用于集合。 从课堂文档: 序列化器类,用于序列化注释属性的内容(集合/数组的元素,地图值)。 只能用于属性(方法,字段,构造函数),而不能用于类本身(因为它们通常是通用的)。 I found the solution. I had to use property conten ...
  • private static final Pattern pat = Pattern.compile("/Date\\((\d+)[\\+\\-](\\d+)\\)/"); ... String data = "/Date(1379542610387+1000)/"; Matcher m = pat.matcher(data); if (m.matches()) { long time = Long.valueOf(m.group(1)); int offset = Integer.v ...
  • 我认为你最好的选择是在序列化时传递一种新的日期格式。 例如: final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm")); 基于github上的JavaDocs,它可以深入了解如何确定日期格式,而无需指定自己的格式,我认为您只能使用数字时间戳或Jackson定义的内置ISO格式。 文件供参考: /** * F ...
  • 使用@JsonInclude注释。 @JsonInclude(Include.NON_NULL) class Foo { String bar; } 编辑 您也可以创建自己的序列化程序。 例如 : public static void main(String[] args) throws JsonProcessingException { List strings = new ArrayList<>(); strings.add("string 1" ...

相关文章

更多

最新问答

更多
  • 如何检索Ember.js模型的所有属性(How to retrieve all properties of an Ember.js model)
  • maven中snapshot快照库和release发布库的区别和作用
  • arraylist中的搜索元素(Search element in arraylist)
  • 从mysli_fetch_array中获取选定的值并输出(Get selected value from mysli_fetch_array and output)
  • Windows Phone上的可用共享扩展(Available Share Extensions on Windows Phone)
  • 如何在命令提示符下将日期设置为文件名(How to set file name as date in command prompt)
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • 从iframe访问父页面的id元素(accessing id element of parent page from iframe)
  • linux的常用命令干什么用的
  • Feign Client + Eureka POST请求正文(Feign Client + Eureka POST request body)
  • 怎么删除禁用RHEL/CentOS 7上不需要的服务
  • 为什么Gradle运行测试两次?(Why does Gradle run tests twice?)
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在android中的活动之间切换?(Switching between activities in android?)
  • Perforce:如何从Depot到Workspace丢失文件?(Perforce: how to get missing file from Depot to Workspace?)
  • Webform页面避免运行服务器(Webform page avoiding runat server)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 内存布局破解(memory layout hack)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • 我们可以有一个调度程序,你可以异步添加东西,但会同步按顺序执行吗?(Can we have a dispatcher that you can add things todo asynchronously but will be executed in that order synchronously?)
  • “FROM a,b”和“FROM a FULL OUTER JOIN b”之间有什么区别?(What is the difference between “FROM a, b” and “FROM a FULL OUTER JOIN b”?)
  • Java中的不可变类(Immutable class in Java)
  • bat批处理文件结果导出到txt
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • 德州新起点计算机培训学校主要课程有什么?
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • “latin1_german1_ci”整理来自哪里?(Where is “latin1_german1_ci” collation coming from?)