Redis 서버를 사용하는 Eclipse에서 프로그램을 디버깅/테스트하고 싶어서 서버를 사용자 서비스로 전환하여 실행 권한을 얻기로 결정했습니다. 나를 괴롭히는 것은 서비스를 시작하거나 중지할 수 있지만 활성화/비활성화할 수는 없다는 것입니다.
내가 얻는 오류는 다음과 같습니다.
Failed to execute operation: No such file or directory
원본 /usr/lib/systemd/system:
[Unit]
Description=Advanced key-value store
After=network.target
[Service]
User=arkos
ExecStart=/usr/bin/redis-server /etc/arkos/arkos-redis.conf
ExecStop=/usr/bin/redis-cli shutdown
[Install]
WantedBy=multi-user.target
편집하여 /usr/lib/systemd/user로 이동합니다.
[Unit]
Description=Advanced key-value store
[Service]
ExecStart=/usr/bin/redis-server /etc/arkos/arkos-redis.conf
ExecStop=/usr/bin/redis-cli shutdown
[Install]
WantedBy=default.target
시스템 제어 상태:
�� arkos-redis.service - Advanced key-value store
Loaded: loaded (/usr/lib/systemd/user/arkos-redis.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2015-08-25 09:19:25 UTC; 1min 55s ago
Process: 644 ExecStop=/usr/bin/redis-cli shutdown (code=exited, status=1/FAILURE)
Main PID: 736 (redis-server)
CGroup: /user.slice/user-1000.slice/[email protected]/arkos-redis.service
������736 /usr/bin/redis-server *:0
Aug 25 09:19:25 arkos-vagrant redis-server[736]: | `-._`-._ _.-'_.-' |
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-._`-.__.-'_.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-.__.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-.__.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.471 # Server started, Redis version 3.0.3
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 * The server is now ready to accept connections at /tmp/arkos-redis.sock
저널 ctl:
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.470 # You requested maxclients of 10000 requiring at least 10032 max file descrip
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.470 # Redis can't set maximum open files to 10032 because of OS error: Operation
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.470 # Current maximum open files is 4096. maxclients has been reduced to 4064 to
Aug 25 09:19:25 arkos-vagrant redis-server[736]: _._
Aug 25 09:19:25 arkos-vagrant redis-server[736]: _.-``__ ''-._
Aug 25 09:19:25 arkos-vagrant redis-server[736]: _.-`` `. `_. ''-._ Redis 3.0.3 (00000000/0) 64 bit
Aug 25 09:19:25 arkos-vagrant redis-server[736]: .-`` .-```. ```\/ _.,_ ''-._
Aug 25 09:19:25 arkos-vagrant redis-server[736]: ( ' , .-` | `, ) Running in standalone mode
Aug 25 09:19:25 arkos-vagrant redis-server[736]: |`-._`-...-` __...-.``-._|'` _.-'| Port: 0
Aug 25 09:19:25 arkos-vagrant redis-server[736]: | `-._ `._ / _.-' | PID: 736
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-._ `-./ _.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: |`-._`-._ `-.__.-' _.-'_.-'|
Aug 25 09:19:25 arkos-vagrant redis-server[736]: | `-._`-._ _.-'_.-' | http://redis.io
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-._`-.__.-'_.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: |`-._`-._ `-.__.-' _.-'_.-'|
Aug 25 09:19:25 arkos-vagrant redis-server[736]: | `-._`-._ _.-'_.-' |
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-._`-.__.-'_.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ `-.__.-' _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-._ _.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: `-.__.-'
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.471 # Server started, Redis version 3.0.3
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING overcommit_memory is set to 0! Background save may fail under low m
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING you have Transparent Huge Pages (THP) support enabled in your kerne
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sy
Aug 25 09:19:25 arkos-vagrant redis-server[736]: 736:M 25 Aug 09:19:25.472 * The server is now ready to accept connections at /tmp/arkos-redis.sock
답변1
심볼릭 링크 문제?
심볼릭 링크를 사용할 때 비슷한 오류 메시지가 나타났습니다.
분명히 systemd는 심볼릭 링크를 따르지 않으며 해결책은 파일을 복사하거나 이동하는 것입니다.
사용자 서비스?
--user
명령줄에 단위를 추가해야 한다고 생각합니다 user/
.
sudo systemctl --user enable arkos-redis.service
답변2
제 경우에는 systemd 유닛 파일을 /etc/systemd/system/...
폴더 바로 아래에 배치했습니다. 로 이동 /lib/systemd/system
하고 systemctl 활성화/비활성화 명령 문제를 해결했습니다.
답변3
노력하다:
sudo touch /etc/init.d/arkos-redis
나는 같은 문제를 가지고있다. 이것이 작동하지 않는 경우:
sudo strace systemctl enable arkos-redis
마지막 실패가 발생한 위치를 찾으십시오.
답변4
내 경험상 이런 일은 대개 서비스가 차단될 때 발생합니다.
~]# systemctl status zabbix-agent
● zabbix-agent.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
~]# systemctl is-enabled zabbix-agent
masked
~]# ls -l /etc/systemd/system/zabbix-agent.service
lrwxrwxrwx. 1 root root 9 Feb 29 2020 zabbix-agent.service -> /dev/null
~]# systemctl unmask zabbix-agent
Removed symlink /etc/systemd/system/zabbix-agent.service.
~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
일단 밝혀지면 활성화할 수 있습니다.
이것이 누군가에게 도움이 되기를 바랍니다.