I want to use Redis as memory only. But when I start it, it loads the content of my test run (that used just the default config, i.e. without config file).
How can I prevent it to load that stuff? (Beside deleting these files. I want to ensure by configuration that I don't mistakenly load data.)
My current configuration:
# Redis configuration
# - memory only
# - limited to 1 GB
loglevel warning
databases 4
maxclients 50
maxmemory 1GB
maxmemory-policy noeviction
# milliseconds
lua-time-limit 100
# microseconds
slowlog-log-slower-than 10000
slowlog-max-len 1000
# subscribe __keyevent#0__:expired
notify-keyspace-events Ex
# is this needed?
appendonly no
You should:
Use a .conf file
Remove the .rdb file (once) prior to starting redis-server
Comment out your save entries; see this comment in the default .conf : Note: you can disable saving at all commenting all the "save" lines.
If you want to check the runtime config, you can let redis rewrite your .conf file.
See: CONFIG REWRITE
Diff your previous config to the rewritten one, so you can see what you're missing.
To see the actual config on a running redis-server instance, use CONFIG GETExample from redis-cli:
127.0.0.1:14130> config get *save*
You can also set some config options online, see CONFIG SET
If you want to daemonize your test server, use install_server.sh. This script has had a major overhaul in 2.8.8. I recommend you do this (if possible/permissions), since it sets up a nice structure with the .conf where it should be, according to your OS's standards. Also, you can configure the daemon to start automatically after a server reboot.
Hope this helps, TW
Related
I try to write an ansible role for redis/sentinel and am stuck at one point:
Since sentinel writes create config rewrites, the config always changes which triggers always changes
A way out could be to to configure sentinel to write the CONFIG REWRITE in another file and include that one in the main redis.conf
Is this possible somehow ? Or are there any other methods to not have the changes in the main redis.conf
I am using ubuntu 14.04 and I have managed to use rsyslog to push my Apache error logs to Papertrail. I then moved onto monitor another log file and after a restart and commenting out the apache config lines, I still get apache logs being monitored!
Does rsyslog cache config files somewhere? I have restated rsyslog via sudo service rsyslog restart and /etc/init.d/rsyslog restart.
Here is my current config file that seems to be monitoring my apache error.log file even though it is commented out.
$ModLoad imfile
$InputFilePollInterval 10
# Apache Error file:
#$InputFileName /var/log/apache2/error.log
#$InputFileTag apache-error:
#$InputFileStateFile stat-apache-error
#$InputFileSeverity error
#$InputRunFileMonitor
# App Error files:
$InputFileName /var/www/html/application/logs/log.php
$InputFileTag apache-error:
$InputFileStateFile stat-apache-error
$InputFileSeverity error
$InputRunFileMonitor
When I comment out this whole file, the apache errors stop being monitored. I am very confused, any help appreciated.
I can't explain the symptom you described, but did notice another problem which may be related. The InputFileStateFile configuration flag is a filename where rsyslog keeps its current position in the target file (InputFileName). The state file (stat-apache-error) is not deleted when rsyslog stops, so rsyslog knows where to start sending.
Using the same state file for 2 different underlying files will probably make rsyslog start at the wrong place, since the offset from /var/log/apache2/error.log won't be correct for /var/www/html/application/logs/log.php. Either use a different state file or remove the stat-apache-error file when you enable the second config.
I'm running vagrant on OSX, Ubuntu, and Windows 7 and using vim and Netbeans as IDEs on the host machine. The VM is running CentOS 6.3 and Apache 2.2. The docroot is set to /vagrant.
When I edit a JS or CSS file and save it, the browser then turns around and detects illegal characters. When I view the file in the browser I see the diamond-question mark character which usually points to an encoding issue. I can open the file up in vim inside the VM and save it with :w ++enc=utf-8 and the file will load normally.
I've tried multiple IDEs on the host machine and different host OSes, and can only pinpoint it to something to do with vagrant and the mounted directory. My IDEs aren't the problem as I can run the files locally and they work, or save them to a remote machine and the files work. Only when I save them to what gets mounted in /vagrant do I have a problem.
Is it Apache or something else in the OS that I need to change to get this to work?
I had this problem this morning. Set EnableSendfile to off in your httpd.conf.
If you look at your httpd.conf it says "turn this off if you serve from NFS-mounted filesystems." In http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile it explains that "By default, when the handling of a request requires no access to the data within a file -- for example, when delivering a static file -- Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it."
Since your windows host has an ntfs file system, the linux guest doesn't properly cache the file with sendfile and so apache needs to send the file itself. This may cause a marginal slowdown when requesting files from apache, but it should be negligible.
It depends on what server you are using.
For Nginx: in /etc/nginx/nginx.conf:
change the line that contains sendfile on; to sendfile off;.
For Apache: in /etc/httpd/conf/httpd.conf:
change remove comment for EnableSendfile off;
And don't forget restart your Nginx or Apache. If it still doesn't work, exit and vagrant reload or something like that - restart your VM.
I have discovered that my access_log is occupying most of my HDD. It's over 200 GB in size. How can I reset it ?
I am using Apache 2.2.3 on a CentOS server with Plesk.
Thank you guys !
knx'answer is good, but I would suggest to rename the log, and create a new one, so that you can restart apache without waiting for the access log to be compressed, which can take a while if it's big.
needs access to ssh
First, rename the current log file:
mv /var/log/apache/access.log /var/log/apache/access.log.1
Second, create a new log file and give the same permissions, owner/group and selinux context as the original one:
touch /var/log/apache/access.log
chown --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
chmod --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
restorecon --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
(probably need to be root to do that)
Next, restart apache
Then Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:
gzip -c /var/log/apache/access.log.1 > /var/log/apache/access.log.1.gz
these 4 points are what logrotate do automatically.
If you have access by SSH to the server, then you can:
1) Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:
gzip -c /var/log/apache/access.log > /var/log/apache/access.log.gz
2) Clear the current file
echo > /var/log/apache/access.log
3) Restart apache
Also as Dez has suggested consider using logrotate for production grade apache log archiving.
Use the logrotate daemon in order to have a clean maintenance of your logs, specially, the apache related logs.
A brief info about logrotate: http://www.scriptinstallation.in/logrotate.html
If on Ubuntu do:
sudo su
cd /var/log/apache2
rm access.log
rm error.log
touch access.log
When creating that access log it magically starts the error log too.
I know this post is ages old, but I just had same problem and no answer covers it correctly.
The point is the apache creates the file as access_log, according to its configuration. However, logrotate only looks for *.log, hence the name does not match the search pattern.
Solutions: Either you add *_log to logrotate configuration, or change the apache configuration to make it create the log file named access.log. Changing apache configuration requires apache reload.
A simple solution is to disable access_log, commenting only one line on the configuration file.
Source: https://www.mydigitallife.info/how-to-disable-and-turn-off-apache-httpd-access-and-error-log/
For Plesk users:
https://stackoverflow.com/a/41000240/1792240
Rename the file, create a new access_log, then restart Apache.
Rename the file to different filename and create new file with the name access_log and restart apache (otherwise apache keeps the lock on the file and don't "see" the file change)
What are the access.log.* files?
Apache, I believe, does log rotation. So these would be the older log files with the access.log file being the current one.
Apache / apache2 itself doesn't do its own log rotation. On *nix systems, logs (including logs by Apache) are usually rotated via logrotate, a command which looks like a service but is actually only a script triggered by cron in defined intervals. (#nobody already pointed that out in comments). One default logrotate configuration appends ".1" to an older, rotated log, so a file like access.log.1 would end up in your logs directory. This is what you are probably seeing.
Is it possible to have apache log to multiple log files?
The question's title can be ambiguous. For anyone coming here to learn if it is possible to make Apache write to multiple log files simultaneously, the answer is: Yes.
The TransferLog or CustomLog directives are used to define logfiles. These directives can be repeated to make Apache write to more than one log file. This also works for VHOSTS / Virtual Host entris. Only ancient Apache releases were limited to only one logfile per server configuration.