Two people were in custody after the shooting at Australia’s best-known beach, the police said. The authorities advised people nearby to take shelter.