Cannot get redis 5 to run with systemctl
Installed Redis 5 (have Redis 3 working on server)
Modified various configurations in /etc/opt/rh/rh-redis5/redis.conf as necessary including setting supervised to "systemd" and setting daemonize to no. (I also tried "auto" for supervised with no luck).
But when I start it up with the following command
systemctl start rh-redis5-redis.service
I get the error below:
Dec 02 16:18:23 myserver systemd[1]: Starting Redis persistent key-value database...
Dec 02 16:18:23 myserver systemd[1]: rh-redis5-redis.service: main process exited, code=exited, status=1/FAILURE
Dec 02 16:18:23 myserver systemd[1]: Failed to start Redis persistent key-value database.
Dec 02 16:18:23 myserver systemd[1]: Unit rh-redis5-redis.service entered failed state.
Dec 02 16:18:23 myserver ystemd[1]: rh-redis5-redis.service failed.
rh-redis5-redis.service file has
[Unit]
Description=Redis persistent key-value database
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/opt/rh/rh-redis5/root/usr/bin/redis-server /etc/opt/rh/rh-redis5/redis.conf --supervised systemd
ExecStop=/opt/rh/rh-redis5/root/usr/libexec/redis- shutdown
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
I have seen others had this problem but other than changing supervised and daemonize I don't see any other remedies that would help me. Any suggestions?
See also questions close to this topic
-
Arch- Linux installation successful but not booting
l have installed arch- linux successfully using the bios way and every just worked fine. But it doesn't boot ,what could be the problem
-
Problem when Handling repeated error values on php and mysql
I have a PHP program that connect to a MariaDB databse.
I upload name as "numbers" and i defined the value as UNIQUE so I don´t want to be repeatated.
However I would like to handle the error when a vlaue is repeated:
This is the table I created:
Table in MariaDB
create table test( -> id int NOT NULL AUTO_INCREMENT, -> name varchar(255) UNIQUE, -> date DATE NOT NULL, -> PRIMARY KEY (id) -> );
This is the script in PHP:
$host = "localhost"; $db_name = "xxx"; $username = "xxx"; $password = "xxx"; $connection = null; $dt1=date("Y-m-d"); try{ $connection = new PDO("mysql:host=" . $host . ";dbname=" . $db_name, $username, $password); $connection->exec("set names utf8"); } catch(PDOException $exception){ echo "Connection error: " . $exception->getMessage(); } function saveData($name, $dt1){ global $connection; $query = "INSERT INTO test(name, date) VALUES( :name, :date )"; $callToDb = $connection->prepare( $query ); $name=htmlspecialchars(strip_tags($name)); //$dt1=htmlspecialchars(strip_tags($dt1)); $callToDb->bindParam(":name", $name); $callToDb->bindParam(":date", $dt1); if($callToDb->execute()){ //return '<h3 style="text-align:center;">registration submmited!</h3>'; //if (!$callToDb->execute()) { // if ($callToDb->errno == 1062) { // return '<h3 style="text-align:center;">VALUE REPEATED!</h3>'; // } // else{ return '<h3 style="text-align:center;">registration submmited!</h3>'; // } } } if( isset($_POST['submit'])) { $name = htmlentities($_POST['name']); $dt1 = htmlentities($_POST['date']); //then you can use them in a PHP function. $result = saveData($name, $dt1); echo $result; } else{ echo '<h3 style="text-align:center;">A very detailed error message</h3>'; } //header("location:javascript://history.go(-1)"); }
the code part after
if($callToDb->execute()){
it is commented because it is not working but I would like to just show a message when the vlaue is repeated. The same than when a vlaue is registrated correctly.The issue to handle duplicate error is in this part which at the moment I am not using in my code as is not working fine:
if (!$callToDb->execute()) { if ($callToDb->errno == 1062) { return '<h3 style="text-align:center;">VALUE REPEATED!</h3>'; } else{ return '<h3 style="text-align:center;">registration submmited!</h3>'; } }
Any idea why this part of the code it is not working?
-
httplib2 :- argument should be integer or bytes-like object, not 'str'
I am using Google Indexing API, and I am getting this error
argument should be integer or bytes-like object, not 'str'
I am implementing the API on the Django server when I run it on my local machine it runs just fine. but when I put it on pythonanywhere it is giving me the above error. I don't know what's the reason for this error. here is the function
def demo(request): context = {} if request.GET: link = request.GET.get('link') key = request.GET.get('key') if link and key: context = { 'link': link, 'key': key, } try: key = json.loads(key) except: return render(request, 'google_api_demo/index.html', context) scope = [ "https://www.googleapis.com/auth/indexing" ] endpoint = "https://indexing.googleapis.com/v3/urlNotifications:publish" credentials = ServiceAccountCredentials.from_json_keyfile_dict(key, scopes=scope) http = credentials.authorize(httplib2.Http()) content = bytes(str({ "url": f"{link}", "type": "URL_UPDATED", }), encoding='utf-8') response, content = http.request(endpoint, method="POST", body=content) context['response'] = response context['content'] = content return render(request, 'google_api_demo/index.html', context) return render(request, 'google_api_demo/index.html', context)
-
Why Redis is O(N) for lindex, lpop
I am trying to get my head around why
lindex
is O(N)?This is related to needing to delete an element from list by index, and realizing that Redis only allows you to remove by value. So lindex first and then lrem.
Neither is better than O(N).
I don't get how redis is built. I mean is the list a Map? How does it retain indexes, order? Is is a LinkedList? Head, tail seems to suggest it is.
Also, none of the methods appear to be better than O(N).
Why do we not have lrem by index. Why only by value?
-
Redis TimeoutException
I'm pushing some data to a Redis instance from a console app every few seconds. This is roughly how I'm doing it:
int foo = GetFoo(); BigObject bar = GetBigObject(); _cache.StringSet("Foo", JsonConvert.SerializeObject(foo)); _cache.StringSet("Bar", JsonConvert.SerializeObject(bar));
but after a while I get an exception:
StackExchange.Redis.RedisTimeoutException: 'Timeout performing SET RtSignal-op (5000ms), inst: 0, qu: 0, qs: 0, aw: False, rs: CompletePendingMessage, ws: Idle, in: 0, in-pipe: 5, out-pipe: 0, serverEndpoint: Unspecified/localhost:5002, mgr: 9 of 10 available, clientName: SVGD0083, IOCP: (Busy=0,Free=1000,Min=16,Max=1000), WORKER: (Busy=3,Free=32764,Min=16,Max=32767), v: 2.0.593.37019 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)'
In the linked to page there is a suggestion that the issue might be a result of
Thread Theft
and the solution is to include the following line:ConnectionMultiplexer.SetFeatureFlag("preventthreadtheft", true);
The problem is that there doesn't seem to exist a
SetFeatureFlag
method in .NET framework.Any ideas?
-
Is all redis cluster master nodes data same?
For example, I have A, B, C master nodes and A1, B1, C1 slave nodes in redis cluster. I know A would sync data to A1, as well as B and C.
So, are there the same data in A, B, C master nodes?
-
Can't mount a permanently installed USB flash drive to the mount point of my choosing with Raspian 10
I want my Raspberry Pi 4B, running Raspian 10, to boot up with a permanently-inserted USB flash drive mounted to /srv/www. The flash drive will never be removed. I formatted the flash drive with an ext4 filesystem. I can manually mount the drive to /srv/www and perform normal file operations.
When I add an entry to /etc/fstab like this:
/dev/sda1 /srv/www ext4 0 0
or like this:
UUID=651003ce-5261-4b00-9940-6207625a5334 /srv/www ext4 0 0
the mount does not succeed when the system boots. I've been at this for hours, trying various suggestions for configuring systemd and see a variety of errors in system logs such as "/dev/sda does not contain a filesystem" but fsck tells me it does. Before I go spend more hours, is what I'm trying to do possible and where am I going wrong?
-
Systemd run script after wakeup: "Can't open display"
I have a script which does things with screen brightness, works fine that's cool and now I want to make it run after wake up from suspend.
So I tried using systemd, I have a file under
/etc/systemd/system/myscript.service
which is as follows:[Unit] Description=Run myscript after wakeup After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target [Service] Type=oneshot ExecStart=/usr/local/bin/myscript User=me #Environment=DISPLAY=:0 [Install] WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
Note:
User
is set because the myscript needs HOME variable.After I run
sudo systemctl enable myscript
and try suspend/wakeup, myscript is not run andjournalctl -u myscript.service
outputs the following message:Jan 25 13:42:53 mymachine myscript[24489]: Can't open display
Jan 25 13:42:53 mymachine systemd[1]: myscript.service: Succeeded.
Jan 25 13:42:53 mymachine systemd[1]: Finished Run myscript after wakeup.If I uncomment the line
#Environment=DISPLAY=:0
in myscript.service the error is "Can't open display :0"Any help would be great :^)
-
Is it possible to run a bash script in java from systemd daemon service
I want to run Java exec when the code is running as a systemd linux ( Ubuntu 18.04 ) service, is that possible? If it is possible, how? Right now, my code is running if I run the code in the terminal, it calls the bash script and bash script does the job. However, when my program is running as a systemd service, it hangs and bash script does nothing. Any ideas? The bash script will be called from a server through a REST request by the way
I take the exec as;
String[] command = { "bash", "-x", "/some_script.sh" ,"argument1"}; ProcessBuilder probuilder = new ProcessBuilder( command ); probuilder.directory(new File(System.getProperty("user.home"))); Process process = probuilder.start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; System.out.println("Output of running %s is:\n", Arrays.toString(command)); while ((line = br.readLine()) != null) { System.out.println(line); } try { int exitValue = process.waitFor(); System.out.println("\n\nExit Value is " + exitValue); } catch (InterruptedException e) { e.printStackTrace(); }
-
"sudo systemctl enable docker" not available: Automatically run Docker at boot on WSL2 (using a "sysvinit" / "init" command or a workaround)
I am using Ubuntu on WSL2.
According to How to fix docker ‘Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?’ on Ubuntu, I can automatically start the docker daemon at boot using
sudo systemctl enable docker
instead of just starting it again at every boot with
sudo systemctl start docker
with both commands avoiding "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?".
When using any of the two, I get
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable docker
and a test run shows, that docker is not yet running:
docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.
Some steps before, I also got a different message at this point:
System has not been booted with systemd as init system (PID 1). Can't operate.Failed to connect to bus: Host is down"
which brought me to Fixing "System has not been booted with systemd as init system" Error:
Reason: Your Linux system is not using systemd How to know which init system you are using? You may use this command to know the process name associated with PID 1 (the first process that runs on your system):
ps -p 1 -o comm=
It should show systemd or sysv (or something like that) in the output.
ps -p 1 -o comm=
gave meinit
.According to this and this table
I can choose
service docker start
to run docker, which works. But I cannot find something like "systemd"'ssudo systemctl enable docker
for "sysvinit". I would expect it to be like:sudo service docker enable
But that "enable" is not available for "sysvinit" / "init".
While
sudo service docker start
works likesudo systemctl start docker
, there is no such command that uses "enable". At the moment, I need to runsudo service docker start
whenever I start WSL2.The question:
What is the command that reaches
sudo systemctl enable docker
usingsudo service docker ...
, or if that does not exist, what is a workaround here to automatically start docker when opening Ubuntu on WSL2? -
I have an error when systemctl restart networking
i have a problem when i try to use systemctl restart networking. This happens when i change /etc/network/interfaces.
If the file is configured like this is ok:
allow-hotplug ens33
iface ens33 inet dhcpauto ens37
iface ens37 inet static
address 172.15.5.5/24
gateway 172.15.5.1If i change it like this:
auto ens33
allow-hotplug ens33
iface ens33 inet dhcpauto ens37
iface ens37 inet static
address 172.15.5.5/24
gateway 172.15.5.1It shows me this error: Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
What is annoying me is that the way is not working is written on Debian page. this is the page
-
systemclt service failed to send notify-send notification
I need to send notifications while executing a shell script. this shell script run as a systemctl service. if we run the shell script in terminal it works and notifications displays but with systemctl that won't
[Unit] Description=x_start service. [Service] Type=simple ExecStart=/bin/bash /opt/x_start.sh [Install] WantedBy=multi-user.target
shell script
#!/bin/bash notify-send -i face-wink "x System starting.please Wait ... "