LOS ANGELES — Cities across the country that live with the threat of disaster — from earthquakes in San Francisco to hurricanes in Miami — are anxiously watching the catastrophe unfolding in Houston for lessons learned, cautionary tales, anything to soften the blow when their residents are the ones in danger.

“We know we are racing against the clock,” said Elaine Forbes, the executive director of the Port of San Francisco, her office buttressed by a century-old sea wall that could collapse in an earthquake. “Seeing Houston stoked the fire.”

Emergency disaster officials in cities like Baltimore, Boston and Seattle have spent the last week and a half monitoring how Texan government officials and storm-affected residents are responding to a crisis that destroyed homes and disrupted electricity, drinking water and communications.

The causes might be different, but the devastation and social disruption can be similar from disaster to disaster. As such, Houston is offering other cities a real-life run-through of their own emergency plans as well as a stark reminder of the inevitability of such events.

“We look at this and realize that while they might be under water, we someday will be under crumbled buildings,” said Eric M. Garcetti, the mayor of Los Angeles. “And it will take years, if not decades, to rebuild.”

James Redick, the director of emergency preparedness and response in Norfolk, Va., a city that has found itself vulnerable to hurricanes over the years, said he watched the water rise in Houston and began worrying about his own city’s plans to rebuild after a cataclysmic flood.

“I keep asking myself, is our recovery plan good enough for when you essentially have to start over?” Mr. Redick said.

Speaking before Hurricane Irma set its sights on South Florida, Juvenal Santana, Miami’s director of public works, expressed relief last week that his city was not the one in distress. “I’d be lying if I said we are not thankful that we are not sitting here talking about having had the storm come through Miami,” he said.

In Chicago, a city that lives under the threat of tornadoes, blizzards and overflowing rivers, officials watched the Houston response in search of new ways to guide a major population center through a crisis.

“I’m shooting notes over to my guys who work in emergency management and saying, ‘Hey, when was the last time we updated our shelters?’” said Alicia Tate-Nadeau, executive director of Chicago’s Office of Emergency Management and Communications. “‘Do we have a plan to put computers in our shelters, along with phone-charging banks?’”

Some of the lessons, officials said, have been encouraging, in particular the initial willingness of Republicans in Washington, some of whom famously resisted providing assistance after Hurricane Sandy pummeled New York and New Jersey in 2012, to approve the billions of dollars that will be needed to rebuild.

But for many emergency response leaders in major cities, Houston has also been a disturbing reminder of how even the best emergency plans are often not up to the task.

“It makes you realize, these megastorms, if you haven’t been hit by one, your worst-case scenario is nowhere near a true worst-case scenario,” said Daniel J. Kelly, the executive director of the New Jersey Office of Recovery and Rebuilding, as he recalled his state’s struggle to respond to Hurricane Sandy.

In Seattle, which has been bracing for a long-overdue and potentially devastating earthquake along the Cascadia Subduction Zone off the Pacific Coast, officials said Houston has underscored what they have been trying to instill into residents, police and fire agencies and hospitals: assume that nothing will work, from communications systems to roads and electricity grids.

“They need to have themselves ready to be on their own, just like an awful lot of folks are stranded and on their own down in Texas,” said Barb Graff, Seattle’s emergency management director.

For city officials who would have to manage these kind of crises, Houston has been a reminder of one of the toughest parts of their jobs. Martin J. Walsh, the mayor of Boston, told a radio audience that a storm of that magnitude would leave the city “wiped out.”

“It’s made me take a real serious look at how we would handle a storm,” Mr. Walsh said in an interview. “Hopefully a lot of cities and towns around America take their time and pay attention to what’s happening.”

Mr. Walsh said he had talked with the city’s water and sewer engineer about how much rain Boston could absorb without flooding, and had considered which neighborhoods might need to be evacuated. He said the city only had access to 7,200 cots, far fewer than he feared would be necessary in the event of massive flooding.

“Our financial district is pretty much on the coast,” Mr. Walsh said. And a number of the city’s neighborhoods, he added, are on the water.

Across Miami and other Florida cities, like Tampa and Orlando, Harvey ushered in a common refrain: There but for the grace of God. Like Houston, Miami is flat and has gobbled up wetlands like the Everglades and coastal stretches to build and build. The more a city has been paved over, the greater the chance of flooding.

There has typically been an uptick in disaster preparation in the immediate aftermath of a catastrophe — the 1994 Northridge earthquake here prompted many people to stockpile water and batteries, and some cities passed laws requiring vulnerable buildings to install reinforcing walls and pillars. That was just as typically followed by a return to normal behavior as the memory of the disaster faded.

But Lucy Jones, who served for 33 years as a seismologist with the U.S. Geological Service, and was recruited by Mr. Garcetti as his top earthquake adviser, said the reaction to Houston this week has led her to believe that has changed because of the ability of people across the world to feel the disaster up close through arresting images on their mobile phones.

“This will increase public awareness,” she said. “All of these gripping pictures of people in their flooded houses — we are looking at it in real time — is a change in the emotional reaction that I had seen in the past. Think about it: What can you tell me about Hurricane Camille?”

She suggested that events in Houston would thus provide the same kind of motivation to people in Southern California to prepare for the worst as a series of minor temblors did here in 2014.

Scott Ashley, 46, who works the Los Angeles Unified School District, said he remembered the earthquake of 1994, and that in the days since the flooding began in Houston, he had refreshed the emergency kit he had set up to help his family survive the next one.

“We are very ready,” he said. “We have our emergency kits, we have our evacuation plans, M.R.E.’s, water, kits for tents, warm weather supplies, storage space for materials, a kit that will take care of our family for at least 3 days.”

And Los Angeles got a reminder this weekend of the kind of disasters it might have to deal with beyond earthquakes, as wildfires broke out in parts of the city, destroying three homes and closing down a highway as temperatures soared above 100 degrees.

Walt Hubbard, the emergency manager for King County, which includes Seattle, said the Texas experience has demonstrated that many disasters can go on for weeks or even months, and that residents should be prepared for the long haul.

For Sam Liccardo, the mayor of San Jose, Houston reinforced the need for shelters evenly spread across the city and powerful but portable pumps, which his aides are now looking to purchase. “Nothing motivates action like the dreadful disaster that we see in Houston,” Mr. Liccardo said. “You can only hope that we all collectively learn and better prepare.”

Dr. Irwin Redlener, the director of National Center for Disaster Preparedness at Columbia University, said emergency officials in New York state and city government were watching Houston to see how the storm affected high-security plants where dangerous chemicals and pathogens are stored.

“We are all questioning if they are secure enough,” he said. “New Yorkers have no problem imagining that any kind of man-made or natural disaster is not out of the question since we have seen both kind of events.”

Alex Padilla, the California secretary of state and a former state senator who helped push through financing for an early-alert statewide system for earthquakes, said that even though this was a different kind of event in a different state, it could only help efforts here to encourage people to prepare.

“It triggers memories of the Bay Area quake or the Northridge quake, he said, adding that Harvey has prompted many to ask, “Are we ready? Are we prepared?”