Questo è il demone della cache del servizio nomi . Si occupa delle ricerche di gruppo e password per i programmi in esecuzione e quindi memorizza nella cache i risultati della ricerca per la query successiva per i servizi che possono riscontrare lentezza nel raccogliere modifiche come NIS o LDAP. Se stai eseguendo questi servizi, potresti voler eseguire nscd.
Questo demone può memorizzare nella cache i dati per servizi di nomi, /etc/hosts, DNS, NIS, NIS+ ecc. Questo è solo per utenti locali sulla macchina, perché la cache è realizzata avvolgendo le funzioni in glibc, l'utente remoto non può mai usare questa cache . Ci vuole del tempo per cambiare la cache anche quando i dati DNS originali vengono modificati, quindi fai attenzione a usare questo demone.
Controllo del servizio
Esempio di “chkconfig –list [servizio]”
# chkconfig --list nscd nscd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Opzioni di utilizzo del servizio disponibili:
# service nscd
Usage: /etc/init.d/nscd {start|stop|status|restart|reload|condrestart} Avvio del servizio:
# service nscd start Starting nscd: [ OK ]
Interruzione del servizio:
# service nscd stop Stopping nscd: [ OK ]
Verifica lo stato del servizio:
# service nscd status nscd (pid 15382) is running...
Riavvio del servizio:
# service nscd restart Stopping nscd: [ OK ] Starting nscd: [ OK ]
Ricaricare il servizio per rileggere il file di configurazione:
# service nscd reload Reloading nscd: [ OK ]
Riavvio condizionale del servizio:
# service nscd condrestart Stopping nscd: [ OK ] Starting nscd: [ OK ]
– Quali demoni esegue:/usr/sbin/nscd
– Quali moduli carica:nessuno
Configurazione
Esempio di file di configurazione:
# nscd will run as "nscd" user and not as root.
server-user nscd
# nscd set no debug output. if level is higher than 0, nscd will create some debug output, the higher the level, the more output is produced
debug-level 0
# disable paranoia mode, nscd will not restart itself periodically
paranoia no
# enables the specified service "passwd" cache
enable-cache passwd yes
# Sets the TTL (time-to-live) for positive entries (successful queries) in the specified cache for "passwd" to 600 seconds
positive-time-to-live passwd 600
# Sets the TTL (time-to-live) for negative entries (unsuccessful queries) in the specified cache for "passwd" to 20 seconds
negative-time-to-live passwd 20
# Sets the internal hash table size to 211
suggested-size passwd 211
# Enables checking the file belonging to the specified service "passwd" for changes
check-files passwd yes
# Keep the content of the cache for service "passwd" over server restarts;
persistent passwd yes
# The memory mapping of the nscd databases for service "passwd" is shared with the clients
shared passwd yes
# The maximum allowable size for the service "passwd" set to be 33554432 bytes
max-db-size passwd 33554432
# The .byname requests will add to passwd.byuid or group.bygid cache.
auto-propagate passwd yes Risoluzione dei problemi
A volte riavvia, arresta o avvia il demone NSCD, non svuoterà la sua cache, è necessario utilizzare il seguente metodo per svuotare esplicitamente la vecchia cache:
Prima di CentOS/RHEL 7 :
# service nscd reload
Dopo CentOS/RHEL 7 :
# systemctl restart nscd