Programming/node.js2019. 4. 23. 13:31

process.on 으로 시그널 핸들러를 연결해두는 듯

 

var cluster = require('cluster');

console.log('started master with ' + process.pid);

//fork the first process
cluster.fork();

process.on('SIGHUP', function () {
  console.log('Reloading...');
  var new_worker = cluster.fork();
  new_worker.once('listening', function () {
    //stop all other workers
    for(var id in cluster.workers) {
      if (id === new_worker.id.toString()) continue;
      cluster.workers[id].kill('SIGTERM');
    }
  });
});

[링크 : https://joseoncode.com/2015/01/18/reloading-node-with-no-downtime/]

[링크 : http://zguide.zeromq.org/js:interrupt]

[링크 : https://stackoverflow.com/questions/20165605/detecting-ctrlc-in-node-js]

'Programming > node.js' 카테고리의 다른 글

node.js 항목 확인  (0) 2019.04.23
proxy error: Error: write after end  (0) 2019.04.23
nodejs url param delete  (0) 2019.04.17
url 끝의 /  (0) 2019.04.17
js array key 삭제하기  (0) 2019.04.16
Posted by 구차니
Linux2019. 4. 23. 13:29

service나 systemctl 을 통해 restart하는거야..

걍 stop + start 하면 되는데 reload는 어떻게 구현되나 궁금해서 검색중

흐음.. 몇개 찾아보는데 SIGHUP을 보내는건가?

 

ExecReload=
Commands to execute to trigger a configuration reload in the service. This argument takes multiple command lines, following the same scheme as described for ExecStart= above. Use of this setting is optional. Specifier and environment variable substitution is supported here following the same scheme as for ExecStart=.

One additional, special environment variable is set: if known, $MAINPID is set to the main process of the daemon, and may be used for command lines like the following:

/bin/kill -HUP $MAINPID
Note however that reloading a daemon by sending a signal (as with the example line above) is usually not a good choice, because this is an asynchronous operation and hence not suitable to order reloads of multiple services against each other. It is strongly recommended to set ExecReload= to a command that not only triggers a configuration reload of the daemon, but also synchronously waits for it to complete.

ExecStop=
Commands to execute to stop the service started via ExecStart=. This argument takes multiple command lines, following the same scheme as described for ExecStart= above. Use of this setting is optional. After the commands configured in this option are run, it is implied that the service is stopped, and any processes remaining for it are terminated according to the KillMode= setting (see systemd.kill(5)). If this option is not specified, the process is terminated by sending the signal specified in KillSignal= when service stop is requested. Specifier and environment variable substitution is supported (including $MAINPID, see above).

Note that it is usually not sufficient to specify a command for this setting that only asks the service to terminate (for example, by queuing some form of termination signal for it), but does not wait for it to do so. Since the remaining processes of the services are killed according to KillMode= and KillSignal= as described above immediately after the command exited, this may not result in a clean stop. The specified command should hence be a synchronous operation, not an asynchronous one.

Note that the commands specified in ExecStop= are only executed when the service started successfully first. They are not invoked if the service was never started at all, or in case its start-up failed, for example because any of the commands specified in ExecStart=, ExecStartPre= or ExecStartPost= failed (and weren't prefixed with "-", see above) or timed out. Use ExecStopPost= to invoke commands when a service failed to start up correctly and is shut down again. Also note that the stop operation is always performed if the service started successfully, even if the processes in the service terminated on their own or were killed. The stop commands must be prepared to deal with that case. $MAINPID will be unset if systemd knows that the main process exited by the time the stop commands are called.

Service restart requests are implemented as stop operations followed by start operations. This means that ExecStop= and ExecStopPost= are executed during a service restart operation.

It is recommended to use this setting for commands that communicate with the service requesting clean termination. For post-mortem clean-up steps use ExecStopPost= instead.

[링크 : https://www.freedesktop.org/software/systemd/man/systemd.service.html]

[링크 : https://serverfault.com/questions/767360/how-to-configure-systemd-to-kill-and-restart-a-daemon-on-reload]

 

+

$ systemctl cat nginx | grep ExecReload= 
Or by running: 

$ systemctl show nginx.service --property=ExecReload 
On my system, I get: 

ExecReload=/usr/bin/kill -HUP $MAINPID

[링크 : https://superuser.com/questions/710986/how-to-reload-nginx-systemctl-or-nginx-s]

'Linux' 카테고리의 다른 글

linux 링크속도 줄이기  (0) 2019.04.25
ip별 대역폭 제한하기  (0) 2019.04.25
ata1 comreset failed (errno=-16)  (0) 2019.04.19
crontab 실행 시간 조절하기  (0) 2019.04.18
디렉토리내 중복 파일 확인하기  (0) 2019.04.18
Posted by 구차니
Programming/Java(Spring)2019. 4. 23. 10:19

maven 에서 repackging 이라는걸로 인해서 이렇게 바뀐다는데

file로 보면 war는 data과 war.original은 zip archive data 라고 되어있는데 무슨 차이인지 감이 안오네..

 

The answer is that you are using repackage goal in your spring-boot-maven-plugin. So, What it does?

Maven first builds your project and packages your classes and resources into a WAR (${artifactId}.war) file.

Then, repackaging happens. In this goal, all the dependencies mentioned in the pom.xml are packaged inside a new WAR (${artifactId}.war) and the previously generated war is renamed to ${artifactId}.war.original.

[링크 : https://stackoverflow.com/.../why-spring-boot-generate-jar-or-war-file-with-original-extention/43641913]

[링크 : https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html]

 

[링크 : http://repackage.org/]

 

Repackages existing JAR and WAR archives so that they can be executed from the command line using java -jar. With layout=NONE can also be used simply to package a JAR with nested dependencies (and no main class, so not executable).

[링크 : https://docs.spring.io/spring-boot/docs/current/maven-plugin/repackage-mojo.html]

 

[링크 : https://preamtree.tistory.com/69]

Posted by 구차니

2016년 2월 제작된 동영상으로 12:25분 길이의 짧은 내용이다.

내용만 보면 정말 싸움꺼리도 없는 평이한 내용인데.

책팔이들이 비난 꺼리를 만들어 준건거 싶은 생각이 든다.

 

[링크 : https://www.ted.com/talks/reshma_saujani_teach_girls_bravery_not_perfection/discussion?language=ko]

 

+

이 사람 회사에서 코딩을 가르치는데 남자들은 코드가 이상해요

여자애들은 제가 잘못했나봐요 라고 하면서 온다고 한다.

그리고 여자애들은 백지로 오는데 ctrl-z 해보면 무언가 막 작성했다가 약간의 실수로 작동하지 않으면

백지로 물어보러 온다고는 이야기를 한다.

 

아무튼 여자들에게 완벽보다는 용기를 주라는 것. 참 좋은말인것 같다.

남자입장으로 많은 여자동기들이 정말 남자 기준 어이없는 상황에서 무너져 아무것도 하지 못하는 것을 보아왔기에

내 아이들에게 만큼은 포기하지 않고 쓰러지지 않고 끝까지 결과를 내기위해 악착같이 싸우게 가르치고 싶은데

그것과 동일 선상에 있는 철학이라고 생각이 된다.

'개소리 왈왈 > 페미니즈음' 카테고리의 다른 글

관음충의 발생학?  (2) 2021.03.24
뷔페니즘 비판기사  (2) 2019.05.03
낙태약과 약사협회  (0) 2019.04.15
의대 한동안 산부인과가 1등일 듯  (2) 2019.04.12
22주 이전 낙태 2021년 부터 허용?  (2) 2019.04.11
Posted by 구차니
프로그램 사용/docker2019. 4. 22. 11:04

docker 기반의 카산드라에 sql 클라이언트 실행하기

$ docker exec -it container_id cqlsh

[링크 : https://medium.com/@michaeljpr/five-minute-guide-getting-started-with-cassandra-on-docker]

 

키스페이스 = table? 이런 개념인진 모르겠지만

테이블에 앞서 키스페이스를 확인하라고 하는걸 보니.. 

Sinse v 6.0 Docs 
Get keyspaces info 
SELECT * FROM system_schema.keyspaces 

Get tables info 
SELECT * FROM system_schema.tables WHERE keyspace_name = 'keyspace name'; 

Get table info 
SELECT * FROM system_schema.columns  
WHERE keyspace_name = 'keyspace_name' AND table_name = 'table_name'; 

 

추천수가 낮은 답변인데 이걸로 하면 일반적인 db에서 말하는 database를 확인가능하고

. 누르고 탭을 누르면 자동완성되니 나름 편하게 확인가능 할 듯

desc keyspaces;

[링크 : https://stackoverflow.com/questions/38696316/how-to-list-all-cassandra-tables]


'프로그램 사용 > docker' 카테고리의 다른 글

docker offline image  (0) 2019.05.16
cassandra 메모리 관리  (0) 2019.05.15
docker-compose up/down 주의사항  (0) 2019.03.24
docker 컨테이너 자동시작  (0) 2019.03.21
docker cassandra selinux  (0) 2019.03.20
Posted by 구차니

설사에 혈변을 해대서 병원갔더니

7.8만..

 

 

아니 언니가 너 나으면 소고기 사준댔는데..

니 병원비가 소고기 보다 비싸.. ㅠㅠ

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

간만에 피싱 메일  (4) 2019.06.13
몸이 고장나는 시기구만..  (2) 2019.05.25
딸기향이 싫어진다.  (2) 2019.04.17
희한하게 피곤..  (0) 2019.04.09
어라 부품들이 많네..?  (0) 2019.04.06
Posted by 구차니

어제 12시 조금 전에 도착해서 기절

눈 뜨니 8시

 

목욕탕 다녀오고 낮잠잤는데 한 3시간?

 

그래도 아내랑 아내친구랑 딸래미들 잘 노는거 보면 된거지 머

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

피곤쓰  (2) 2019.04.28
분노쓰  (0) 2019.04.27
아이에게 조심해라가 잘못된 걸까?  (2) 2019.04.18
또 하루의 정신없는 끝  (0) 2019.04.14
똥개 피똥.. 토..  (0) 2019.04.13
Posted by 구차니
Linux2019. 4. 19. 17:36

찾아도 안나오네...

일단 다른 하드를 달아서 해결..

아마도 하드 자체가 망가져서 그런 듯?

 

(검색하다 보니 noapic 이나 ahci 설정 관련으로 인식이 안되는 것도 있었던 듯..)

'Linux' 카테고리의 다른 글

ip별 대역폭 제한하기  (0) 2019.04.25
systemctl restart 시그널  (0) 2019.04.23
crontab 실행 시간 조절하기  (0) 2019.04.18
디렉토리내 중복 파일 확인하기  (0) 2019.04.18
tar 에서 파일 삭제하기  (0) 2019.03.04
Posted by 구차니
Linux2019. 4. 18. 10:48

*/5 로 설정해서 5분 마다 실행하게 했는데

두개를 동시에 해놨더니 공유문제 생겨서 하나는 실행을 못한다고 에러가 잔뜩 쌓였다.

 

그래서 5분 주기로 실행하되, 2분 차이를 두고 해보려니

*은 0-59와 같은 의미이고

 

*/5

3-59/5

이런식으로 두개를 해두면

하나는 정각부터 시작해서 5분 간격

다른 하나는 3분 부터 시작해서 5분 간격으로 된다고 한다.

일단은 걸어놨으니 기다려 봐야 할 듯

[링크 : https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset]

'Linux' 카테고리의 다른 글

systemctl restart 시그널  (0) 2019.04.23
ata1 comreset failed (errno=-16)  (0) 2019.04.19
디렉토리내 중복 파일 확인하기  (0) 2019.04.18
tar 에서 파일 삭제하기  (0) 2019.03.04
sparse file 확인하기  (0) 2019.02.25
Posted by 구차니
Programming/Java(Spring)2019. 4. 18. 10:30

jcmd

[링크 : https://docs.oracle.com/javase/10/tools/jcmd.htm]

 

# jcmd --help
Error parsing arguments: No command specified

Usage: jcmd  PerfCounter.print|-f file>
   or: jcmd -l
   or: jcmd -h

  command must be a valid jcmd command for the selected jvm.
  Use the command "help" to see which commands are available.
  If the pid is 0, commands will be sent to all Java processes.
  The main class argument will be used to match (either partially
  or fully) the class used to start Java.
  If no options are given, lists Java processes (same as -p).

  PerfCounter.print display the counters exposed by this process
  -f  read and execute commands from the file
  -l  list JVM processes on the local machine
  -h  this help

 

근데 보는법을 모르겠다 ㅠㅠ

# jcmd 10776 help
10776:
The following commands are available:
JFR.stop
JFR.start
JFR.dump
JFR.check
VM.native_memory
VM.check_commercial_features
VM.unlock_commercial_features
ManagementAgent.stop
ManagementAgent.start_local
ManagementAgent.start
VM.classloader_stats
GC.rotate_log
Thread.print
GC.class_stats
GC.class_histogram
GC.heap_dump
GC.finalizer_info
GC.heap_info
GC.run_finalization
GC.run
VM.uptime
VM.dynlibs
VM.flags
VM.system_properties
VM.command_line
VM.version
help

For more information about a specific command use 'help 

'.

# jcmd 10776 GC.heap_info
10776:
 PSYoungGen      total 192512K, used 187956K [0x00000000ec400000, 0x00000000f8300000, 0x0000000100000000)
  eden space 189952K, 98% used [0x00000000ec400000,0x00000000f7a0d258,0x00000000f7d80000)
  from space 2560K, 60% used [0x00000000f7d80000,0x00000000f7f00000,0x00000000f8000000)
  to   space 2560K, 0% used [0x00000000f8080000,0x00000000f8080000,0x00000000f8300000)
 ParOldGen       total 647168K, used 591782K [0x00000000c4c00000, 0x00000000ec400000, 0x00000000ec400000)
  object space 647168K, 91% used [0x00000000c4c00000,0x00000000e8de99b8,0x00000000ec400000)
 Metaspace       used 107438K, capacity 109826K, committed 110336K, reserved 1146880K
  class space    used 13031K, capacity 13457K, committed 13568K, reserved 1048576K

[링크 : http://karunsubramanian.com/websphere/how-to-monior-heap-usage-of-a-java-application/]

 

+

GPL 이라는데 상용으로 사용가능한지 모르겠음

[링크 : https://visualvm.github.io/]

 

 

+

클래스 히스토그램은.. 클래스별 메모리 사용량인가?

# jcmd 10776 GC.class_histogram
10776:

 num     #instances         #bytes  class name
----------------------------------------------
   1:        150865      436535528  [C
   2:          7008       47125920  [B
   3:        134955        4318560  java.util.concurrent.ConcurrentHashMap$Node
   4:        145517        3492408  java.lang.String
   5:         11226        3398488  [I

 

찾다보니 jmap -histo pid도 동일한 결과를 내주네..

[링크 : http://www.openkb.info/2014/06/how-to-check-java-memory-usage.html]

 

일단 의미를 보건대.. [C는 Char array 라는 느낌인데

무슨 미친 char 배열 객체가 이렇게 메모리를 쳐드시나...

Element Type        Encoding
boolean             Z
byte                B
char                C
class or interface  Lclassname;
double              D
float               F
int                 I
long                J
short               S 

 

it is an array of objects as specified by JVM Specifications for internal representation of class names:

  • a single [ means an array of
  • L followed by a fully qualified class name (e.g. java/lang/Object) is the class name terminated by semicolon ;

so [Ljava.lang.object; means Object[]

[링크 : https://stackoverflow.com/.../what-do-those-strange-class-names-in-a-java-heap-dump-mean]

 

+

[링크 : https://spring.io/blog/2015/12/10/spring-boot-memory-performance]

Posted by 구차니