1

I need to run laravel 5 app on my local Kubuntu 18 and I need to run redis server for this app

I installed and in file /etc/redis/redis.conf I uncommented line :

requirepass foobared

in .env I modified redis config :

REDIS_HOST=http://127.0.0.1:8000  # I run app with command :  php artisan serve  
REDIS_PASSWORD=foobared
REDIS_PORT=6379 # default port

I restarted redis and check status:

$ sudo service redis status
[sudo] password for serge: 
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-26 13:52:09 EET; 6min ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 1545 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1548 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
 Main PID: 1574 (redis-server)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/redis-server.service
           └─1574 /usr/bin/redis-server 127.0.0.1:6379

Feb 26 13:52:08 AtHome systemd[1]: Starting Advanced key-value store...
Feb 26 13:52:09 AtHome systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Feb 26 13:52:09 AtHome systemd[1]: Started Advanced key-value store.

I see that file Can't open PID file not found above

But I have this file:

root@AtHome:/run/redis# ls -la
total 4
drwxr-sr-x  2 redis redis   60 Feb 26 14:32 .
drwxr-xr-x 38 root  root  1160 Feb 26 14:32 ..
-rw-rw----  1 redis redis    6 Feb 26 14:32 redis-server.pid
root@AtHome:/run/redis# cat redis-server.pid
22676

and I got error on next command :

$ laravel-echo-server start
Error: The config file could not be found.

Is this errors as PID file was not found above?

In /etc/redis/redis.conf I found

pidfile /var/run/redis/redis-server.pid

When I installed the ubuntu I installed /var on separate partition, so I have in /etc/fstab :

UUID=e531d8c5-530c-4533-a949-9fd5a62e0821 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sdb1 during installation

UUID=23cc34a1-2be9-43b1-9c79-8e53af7bc799 /boot           ext4    defaults        0       2
# /var was on /dev/sdb5 during installation

UUID=57c14b70-da85-4c5b-be6f-45174147d987 /var            ext4    defaults        0       2

that is why /var/run/redis/redis-server.pid looks like /run/redis/redis-server.pid in my console command. I do not know can that be key of this problem?

How can it be fixed?

In composer.json :

"laravel/framework": "5.5.*",
"predis/predis": "^1.1",

Thanks!

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
mstdmstd
  • 111
  • 1

1 Answers1

0

Here is an obvious problem:

REDIS_HOST=http://127.0.0.1:8000

You are meant to put the host name or IP address of the redis server here. But instead you have put a URL. Fix that and try again.

REDIS_HOST=127.0.0.1

The redis PID file warning from systemd is spurious and you can ignore it.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Thanks for your tip, but it looks like I still have problems before that : 1) I still very confusing message when check redis start : redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory 2) I still got error when trying to run laravel-echo : $ laravel-echo-server start Error: The config file could not be found. Maybe I miss this file as it is not in git(like .env) and I have createw it? But which name of this file must be ? – mstdmstd Feb 27 '21 at 14:44