Tag-Archive for » cache «

Sunday, August 04th, 2013 | Author:

Stair

Bhí athrú i bhfad ó luaigh mé mo deireanach freastalaí pearsanta – tá sé tar éis fás ag Raidió Rí Rá (Tá sé anois ina 7TB md RAID6) agus bhí sé atógadh le déanaí le Ubuntu Freastalaí.

Arch Ní raibh botún. Arch Linux bhí múinte cheana féin dom an oiread sin faoi Linux (agus leanfaidh sé sin a dhéanamh ar mo dheasc eile). Ach Éilíonn Arch cinnte níos mó ama agus aird ná mar ba mhaith liom a chaitheamh ar fhreastalaí. Go hidéalach, ba mhaith liom is fearr a bheith in ann a dearmad a dhéanamh ar an bhfreastalaí ar feadh tamaill go dtí go deir r-phost meabhrúcháin “tamall de bhlianta anuas … níl nuashonruithe cúpla ba chóir duit féachaint ar, buddy.”

Níl spás saor in aisce – agus nách spás

Bhí an deis dul ar imirce chun Ubuntu an bhfíric go raibh rith mé amach as SATA calafoirt, na calafoirt is gá chun thiomáineann crua a nascadh leis an gcuid eile den ríomhaire – Úsáideann an sraith Raid 7TB a lán de na calafoirt! Bhí mé fiú a tugadh ar shiúl mo an- sean dhiosca crua 200GB mar a thóg sé suas ar cheann de na calafoirt. Rabhadh mé freisin an faighteoir go bhfuil an diosca ar SMART monatóireachta le fios go raibh sé neamhiontaofa. Mar workaround sealadach chun an easpa calafoirt SATA, Bhí mé aistríodh fiú OS an fhreastalaí le sraith de cheithre bataí USB i md RAID1. Crazy. Tá a fhios agam. Ní raibh mé ró-sásta mar gheall ar an luas. Bheartaigh mé dul amach agus a cheannach tiomáint crua iontaofa nua agus cárta leathnú SATA chun dul leis é.

Cuireadh laindéal bunscoile Arch an fhreastalaí a úsáideann thart ar 7GB de diosca. A smután mór de go raibh babhtála comhad, sonraí i dtaisce agus comhaid ilghnéitheacha eile nó nach bhfuil gá. Tríd is tríd an méid iarbhír an OS, lena n-áirítear an /baile fillteán, raibh ach thart ar 2GB. Spreag sé seo dom chun breathnú isteach i Super-tapa SSD tiomáint, ag smaoineamh b'fhéidir nach mbeadh ceann níos lú a bheith chomh costasach. Iompaigh sé amach go bhfuil an feachtas saoire neamh-SSD raibh mé in ann teacht ar iarbhír costas níos mó mó ná ceann amháin de na SSDs réasúnta beag. Yay for me. 🙂

Rogha? Woah?!

I roghnú an OS, Ba mhaith chinn mé cheana féin nach mbeadh sé Arch. Lasmuigh de na dáiltí eile tóir, Tá mé an chuid is mó eolas maidir leis Ubuntu agus CentOS. Fedora Bhí freisin an deis ann – ach ní raibh a mheas mé dáiríre fós é ar feadh freastalaí. Bhuaigh an babhta ubuntu.

An cinneadh eile a bhí mé a dhéanamh nach raibh a tharlaíonn go dom go dtí go Ubiquity (Draoi suiteála Ubuntu ar) D'iarr sé orm: Conas a chur ar bun ar an Deighiltí.

Bhí mé nua chun úsáid a bhaint as SSDs i Linux – Tá mé go maith an eolas faoi na pitfalls de nach n-úsáideann iad i gceart, den chuid is mó mar gheall ar a riosca fadsaoil bochta má mí-úsáid.

Ní raibh mé ag iarraidh úsáid a bhaint as dheighilt babhtála tiomnaithe. Plean mé ar uasghrádú an fhreastalaí motherboard / LAP / cuimhne nach bhfuil i bhfad ró-sa todhchaí. Bunaithe ar sin chinn mé go mbeidh mé babhtála i gcomhad babhtála ar an Raid md atá ann cheana féin. Ní bheidh an babhtála a bheith go háirithe go tapa ach beidh a chuspóir amháin a bheith le haghaidh an ócáid ​​annamh nuair atá rud éigin mícheart agus nach bhfuil an chuimhne atá ar fáil.

D'fhág mé ansin a thabhairt ar an cosán fhréamh an 60GB iomlán amach ar Intel 330 SSD. Mheas mé a scaradh / bhaile ach an chuma air ach beagán pointless, thabhairt ar conas is beag a úsáideadh san am atá thart. Leag mé an chéad suas an laindéal le LVM – rud éigin a bhí mé le déanaí ag déanamh aon uair a leag mé suas le bosca Linux (i ndáiríre, níl aon leithscéal gan úsáid a bhaint LVM). Nuair a fuair sé an chuid i gcás ina mbeadh liom a chumrú córas comhad, Chliceáil mé ar an anuas agus instinctively roghnaithe ext4. Ansin thug mé faoi deara btrfs ar an liosta céanna. Hang on!!

Ach cad?

Btrfs (“im-eff-CSE”, “níos fearr eff-CSE”, “bee-crann-eff-CSE”, nó is cuma cad mhaisiúil tú ar an lá) tá córas comhaid sách nua a fhorbairt chun go mbeidh Linux’ cumais córas comhad ar ais ar an rian le córas comhad reatha ardteicneolaíochta. An Rí-ar-an-Hill atá ann cheana féin córas comhad, “ext” (an leagan reatha a dtugtar ext4) Is maith go leor – ach tá teorainn léi, bhfostú i paraidím d'aois (smaoineamh ar branda nua F22 Raptor vs. le F4 Phantom le iarracht leath-jested ag uasghrádú a ghlacadh) agus is dócha a bheith in ann dul san iomaíocht le haghaidh an-fhada le córais comhaid le Fiontraíocht níos nuaí mar ZFS Oracle. Btrfs Tá fós bealach fada chun dul agus meastar é fós turgnamhach (ag brath ar cé tú ceisteanna a chur agus cad iad na gnéithe is gá duit). Go leor a mheas sé a bheith cobhsaí lena n-úsáid bhunúsach – ach tá aon duine ag dul a dhéanamh ar aon ráthaíochtaí. Agus, ar ndóigh, gach duine ag rá a dhéanamh agus a thástáil cúltacaí!

Mooooooo

Is é an difríocht is bunúsaí idir fo-líne agus btrfs go bhfuil btrfs a “Bó” nó “Cóip ar Scríobh” córas comhad. Ciallaíonn sé seo go riamh go bhfuil na sonraí iarbhír overwritten d'aon ghnó ag an córas comhad ar internals. Má scríobhann tú athrú ar comhad, Beidh btrfs scríobh do chuid athruithe go dtí suíomh nua ar mheáin fhisiciúla agus beidh cothrom le dáta an leideanna inmheánacha a tharchur chuig an suíomh nua. Btrfs a théann céim eile sa mhéid is go na leideanna inmheánacha (dá dtagraítear mar meiteashonraí) Tá freisin Bó. Bheadh ​​leaganacha níos sine de fo-líne a bheith ach overwritten na sonraí. Bheadh ​​Ext4 úsáid Iris chun a chinntiú nach mbeidh éilliú tarlú ba chóir an breiseán AC a yanked amach i láthair na huaire is inopportune. Na torthaí iris i líon céanna de céimeanna a theastaíonn chun sonraí a thabhairt cothrom le dáta. Le SSD, Feidhmíonn an crua-earraí bunúsacha próiseas bó den chineál céanna is cuma cén córas comhaid tá tú ag baint úsáide as. Tá sé seo toisc nach féidir thiomáineann SSD forscríobh iarbhír sonraí – tá siad a chóipeáil na sonraí (le do chuid athruithe) go dtí suíomh nua agus ansin scriosadh an bloc sean go hiomlán. Tá leas iomlán a bhaint sa réimse seo ná nach bhféadfadh SSD scriosadh fiú an bloc d'aois ach go simplí a dhéanamh nóta a scriosadh an bloc ag tráth níos déanaí nuair nach bhfuil rudaí chomh gnóthach. Is é an toradh deiridh go cuí thiomáineann SSD go han-mhaith le córas comhaid bó agus nach bhfuil a dhéanamh chomh maith le córais comhaid le neamh-bó.

Chun a dhéanamh cúrsaí suimiúla, Bó sa chóras comhad a théann go héasca lámh ar láimh le gné ar a dtugtar deduplication. Ligeann sé seo dhá (nó níos mó) bloic comhionann le sonraí a stóráil ag baint úsáide as ach cóip amháin, spás a shábháil. Le bó, má tá an comhad mionathraithe deduplicated, Ní bheidh na focail ar leith tionchar a bheith mar beidh an comhad a mhodhnú ar shonraí a bheith scríofa bloc éagsúla fisiciúil.

Déanann bó i ndiaidh a snapshotting réasúnta éasca a chur i bhfeidhm. Nuair a pictiúr a dhéanamh taifead ar an gcóras ach an pictiúr nua a bheith ina dúbailt na sonraí agus na meiteashonraí laistigh den toirt. Le bó, nuair a dhéantar athruithe, tréimhsí an pictiúr shonraí slán, agus is féidir d'fhonn teacht ar an córas comhaid stádas ag an am a rinneadh an pictiúr a choinneáil.

A chara nua

Leis an méid sin thuas i gcuimhne, go háirithe mar tá Ubuntu ar btrfs ar fáil mar rogha shuiteáil-am, Figured mé go mbeadh sé ina am trátha chun tumadóireacht a dheanamh i btrfs agus beagán iniúchadh. 🙂

Cuid 2 ag teacht go luath …

Comhroinn
Sunday, April 26th, 2009 | Author:

Trust me. We’re still dealing with regexesjust in a roundabout (and vaguely practical) way. This is a pretty comprehensive listing of how to go about flushing DNS caches while using regexes to show where similar methods deviate.

Why do we want to clear DNS caches exactly?

There are a number of reasons to clear DNS caches, though I believe these are the most common:

  • An intranet service has an private (internal) IP address when on the company network but it has a public IP address for outside access. When you try to access that service from outside after accessing it from inside, there’s a chance that you would have cached the private (inaccessible) IP. A good long-term solution is to make the service inaccessible except via VPN. A simpler solution is to leave work at work. 😛
  • An internet service or web site changes their DNS settings and your desktop/laptop is looking at theoldsetting. In this case, the new setting has not yet propagated. Hosting Admins come across this case very often.
  • Príobháideacht: If someone can track your DNS history then it wouldn’t be too hard to figure out which web sites you’ve been viewing. Though the individual pages you’ve viewed can’t be tracked in this way, the hostnames, mar shampla “dogma.swiftspirit.co.za” nó “google.comwill be in the DNS cache, likely in the order you first accessed each site. There are better ways to do this though. One example is to use a Tor network for all DNS requests.

Flushing WindowsDNS cache, from command prompt:

Evidence suggests that prior to Windows 2000, Windows OS’s didn’t cache DNS results. An ipconfig command, run from the command prompt, was given some control over the DNS cache and has remained roughly the same since.

To get to the prompt if using Vista as non-Admin: Start -> Programs -> Accessories -> Right-clickCommand Prompt” -> Run As Administrator

Otherwise: Start -> Run -> [cmd ] -> [ OK ]

ipconfig /flushdns

Flush the DNS Resolver Cache in Windows

It is also possible to clear the cache in Windows by restarting theDNS Client” nó “Dnscache” seirbhíse.

Flushing Mac OS X DNS cache, from shell prompt:

Since Mac OS X, Apple Macs have been running a Unix-based, POSIX-compliant, operating system based on Nextstep, itself originally containing code from FreeBSD agus NetBSD. Mac OS X uses lookupddscacheutil to manage the DNS cache, depending on the version.

To get to the prompt: Applications -> Utilities -> Terminal

(lookupd|dscacheutil) -flushcache

What have we here? As per chuid 1, the vertical bar indicates that eitherlookupdORdscacheutilare acceptable. An parenthesis indicate that the vertical bar only applies to thelookupd|dscacheutilportion of the expression. Thus, the ” -flushcacheis not optional and must be included in the command in order for it to work. Note that these commands produce no output unless there is an error.

Use dscacheutil if you’re using Mac OS X 10.5 (Leopard) or later.

Mac OS X:

lookupd -flushcache

Mac OS X Leopard:

dscacheutil -flushcache

Use dscacheutil to flush the cache in Mac OS X Leopard

There is also a GUI tool, DNS Flusher, which automatically uses the correct command available.

Flushing Linux/UnixDNS cache, from shell prompt:

N.B. If you don’t already have either bind (with caching lookup enabled), nscd, or dnsmasq installed and running on your *nix-based desktop/server, you are probably not caching DNS at all and there is nothing to flush. In that case you will be utilising your DNS server for every web request, probably slowing your web experience.* If so, I recommend at least installing nscd as it is the easiest to set up. **

Flushing nscd’s cache

As with the Mac OS command, this produces absolutely no output unless there is an error:

(|sudo )(|/usr/sbin/)nscd -i hosts
  • Use sudo if you’re not already root otherwise the first selection is blank.
  • Specify /usr/sbin/ if nscd is not already within thepath”. If your distribution has nscd in a strange place, locate it first:
locate -r bin/nscd$

Notice that the abovebin/nscd$is itself a regular expression. 🙂

Using nscd, invalidate thehostscache, logged in as a user:
sudo nscd -i hosts
Using nscd, invalidate thehostscache, logged in as root:
nscd -i hosts
Using nscd, invalidate thehostscache, logged in as root, specifying the full path:
/usr/sbin/nscd -i hosts

Flushing bind’s cache

To flush bind’s cache, we issue a command via rndc. Use sudo if you are not already root:

(|sudo )rndc flush

Restarting the cacheing services also works!

Here’s how to restart either of the caching daemons:

(|sudo )(seirbhíse |/etc/(rc\.d|rc\.d/init\.d|init\.d)/)(bind|dnsmasq|nscd) restart

That’s starting to get difficult to read. *** Luckily I’ve explained in detail:

  • As with the previous command, use sudo if you’re not already root.
  • The second selection has the first option “seirbhíse “. This applies mainly to Red Hat/CentOS and Fedora systems.
  • An “/etc/(rc\.d|rc\.d/init\.d|init\.d)/” needs to be expanded further. This is for most other systems. Generally, the rc.d is for if you’re using a BSD-style init system (for example: Arch Linux, FreeBSD, or OpenBSD). The best way to know for sure which command to use is to ‘locatethe correct nscd or dnsmasq path. Most Unix flavours, even Solaris, use nscd:
locate -r \.d/nscd$ ; locate -r \.d/dnsmasq$ ; locate -r \.d/rndc$
  • The last choice is betweenbind”, “nscd”, agus “dnsmasq”. This depends entirely on which is installed and in use.
  • The last of the pattern, ” restart”, is the instruction given to the daemon’s control script.

Arch, using dnsmasq, restarting the cache daemon, logged in as root:

/etc/rc.d/dnsmasq restart

Arch, using nscd, restarting the cache daemon, logged in as user:

sudo /etc/rc.d/nscd restart

CentOS / Red Hat, using nscd, restarting the daemon, as root:

service nscd restart

nscdrestart

Flush Mozilla Firefox’s internal DNS cache:

Mozilla Firefox keeps its own DNS cache for performance. Firefox 2 would cache only 20 entries for up to 60 seconds. The default setting as of Firefox 3 appears to be 512 entries for up to 60 minutes which seems much more reasonable for every-day browsing. If your desktop has a built-in cache (which most now do) then the cache here is actually redundant. I’m not aware of any other browsers that implement DNS caching.

I’ve found a few solutions for when you need to clear the cache. It seems there are many ways to do this however these are the easiest, which I’ve put into order of preference.:

  1. Install the Firefox DNS Flusher Addonprovides a button to flush the cache.
  2. Install the DNS Cache Addonprovides a toggle which disables or enables the DNS cache.
  3. Clear Cache (clears browser cache as well as DNS Cache): Select Tools -> Clear Private Data; Deselect all checkboxes except for Cache; Click [ Clear Private Data Now ].
  4. Manually do what DNS Cache does: set the following 2 about:config optionsnetwork.dnsCacheExpiration” agus “network.dnsCacheEntries” go 0 and then back to the default.

I had a bad cached record and I cleared my browser’s cache. But its still giving me the wrong info. What gives?

Because of how DNS propagation works, you preferably need to flush the DNS on all DNS hosts between yourself and theauthoritivehost, starting with the host closest to the authoritive host (furthest away from your browser).

As an example, if you have a router that is caching DNS, reset the router’s cache before restarting the DNS cache of your operating system, and only then should you clear the cache in Firefox. The reason is that even if you only clear your OS and Firefox’s caches, your desktop is still going to ask the router for its bad record anyway.

What if my DNS server is a server on the net outside my control?

You could try temporarily using a different nameserver, possibly even a publicly open server. OpenDNS shows some good information on how to do this. If you’d like, you should also be able to get relevant information from your own ISP regarding their resolving DNS servers. A local example (South Africa) is SAIX which lists their resolving DNS servers.

* Likely the reason why Firefox has a DNS cache built-in ****
** “((pacman|yaourt) -S|emerge|(yum|aptitude|apt-get) install) nscdand then ensure that the service is added to the startup scripts. Refer to your distribution’s installation documentation.
*** I’m looking for a syntax highlighting plugin that can work with regex
**** I’ve read statements that restarting the network(ing|) service also clears the DNS cache however I haven’t seen any evidence that this is true. If anyone has a example where this is true, please provide me with the details.
Comhroinn